There's a situation I run into often where I'm looking at long bunches of code where a value is being calculated to be used in a long expression, like THING and OTHER-THING below:
result: case [
...something... [
if condition [
...bunch of code...
thing
] else [
...bunch of code...
other-thing
]
]
...
]
Ultimately, the value is getting stored in RESULT. But it can be hard to make that connection, when this is scrolled across a lot of pages.
I've thought it would be nice to have an annotation that helps to say "this is a used result"...kind of the way that having a RETURN statement on the last line of a function isn't technically necessary, but helps you realize that the last line has a meaningful return value. (I still am personally conflicted over whether or not to require RETURN if you want a value back.)
Long ago, I tried using left arrow as a comment to say "this value is used"
result: case [
...something... [
if condition [
...bunch of code...
<- thing
] else [
...bunch of code...
<- other-thing
]
]
...
]
Kind of a waste of the symbol for a no-op, though.
There might be some strange idiom, like leading comma on the result line to say "oh, and this is the result"
result: case [
...something... [
if condition [
...bunch of code...
, thing
] else [
...bunch of code...
, other-thing
]
]
...
]
Anyway, my discomfort with how easily the important "result" parts vanish into the overall code means this comes up a lot. You can use comments of course:
result: case [
...something... [
if condition [
...bunch of code...
thing ; -> result
] else [
...bunch of code...
other-thing ; -> result
]
]
...
]