Provide a do
term, which allows you to inject a statement into an expression
#200
Labels
do
term, which allows you to inject a statement into an expression
#200
(Though we don't have statement prefixes in 007. It'll most likely just be a kind of term.)
Starting to notice a pattern — for each design decision where we say "007 does this in a simpler way than Perl 6", we can provide a language-mod/macro that re-instates the Perl 6 way. 😄
In this case,
do
would allow things like the following:In other words,
do
allows you to nest a statement right in the middle of an expression.Note that, as a first conservative approximation, all statements that don't alter the control flow and can have an actual return value, will have the value
None
. So you won't be able to do fun stuff like build a retro ternary operator out ofdo
andif
. Sorry.I had this idea when I started to re-read #7.
The text was updated successfully, but these errors were encountered: