You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To avoid blocks in some cases, we've allowed some shorthands. The primary example is if a then b as an alternative to if a { b }
I'm rethinking the choice of then in that situation, and thinking that maybe we should use the do keyword in if as well as in loops and other locations where it makes sense.
if a do something();
while condition() do something();
for x in expr do something(x);
try something() catch => handle_error(it);try something() catch do handle_error(it);
The try example at the end shows how the current "fat arrow" syntax already makes its syntax concise. This proposal may be to make do valid wherever the fat arrow is. However, the fat arrow is not as flexible... if a => b else c looks weird to me, but if a do b else c doesn't.
The text was updated successfully, but these errors were encountered:
To avoid blocks in some cases, we've allowed some shorthands. The primary example is
if a then b
as an alternative toif a { b }
I'm rethinking the choice of
then
in that situation, and thinking that maybe we should use thedo
keyword inif
as well as in loops and other locations where it makes sense.The try example at the end shows how the current "fat arrow" syntax already makes its syntax concise. This proposal may be to make
do
valid wherever the fat arrow is. However, the fat arrow is not as flexible...if a => b else c
looks weird to me, butif a do b else c
doesn't.The text was updated successfully, but these errors were encountered: