Feature: void return
edef1c opened this issue · comments
A void return a la JS's return void EXPRESSION
would rock. Maybe !return EXPRESSION
or return! EXPRESSION
.
something like EXPRESSION; return
?
EXPRESSION; return
?
This, or if you must: return
void expression
That works, though not quite idiomatic. I do if (cond) return void expr
a lot in JS, for short-circuit logic.
return! expr if cond
would be awesome.
That's actually a more common patrern than I first thought, reading node code. if err then cb err; return
is what I'd use (return void expr
gets aci => return void, expr
; and I'm not sure I'd like to see more hushing syntax).
return cb err if err
is very common, along with a variety of similar async dispatches.
return! expr
could compile to expr; return
(return void
is the best we can do when writing JS straight, but we have the opportunity to improve here)
Hmph. True that it is another case forced more verbose than JS.
Options:
- Reuse the hushing analogy as proposed:
!return
(andnot return
) - Treat
return void
(currently useless being the same as justreturn
) as one operator.