Also, what's the reasoning behind specifically disallowing _all_
statement modifiers to "do" blocks (as opposed to forbidding just
looping statement modifiers)? Is this legacy from when the
distinction wasn't being made, or is there still a valid reason for
forbidding conditional modifiers?
Finally: when used as a statement modifier, is "given" considered to
be conditional or looping? (Gut instinct: conditional.)
Yes, there are several similar issues that need to be cleared up
as soon as http://svn.pugscode.org/pugs/src/perl6/Perl-6.0.0-STD.pm
settles down.
: Also, what's the reasoning behind specifically disallowing _all_
: statement modifiers to "do" blocks (as opposed to forbidding just
: looping statement modifiers)? Is this legacy from when the
: distinction wasn't being made, or is there still a valid reason for
: forbidding conditional modifiers?
In addition to not confusing people with differing Perl 5 semantics, it also
discourages people from violating the endweight principle. If the front
is heavy enough to need a block, why not go ahead and use a regular if?
: Finally: when used as a statement modifier, is "given" considered to
: be conditional or looping? (Gut instinct: conditional.)
Why does it have to be one or the other? It's just a topicalizer.
Larry
One implication of replacing "statement_modifier" with
"statement_mod_cond" and "statement_mod_loop" is that every statement
modifier has to be defined as one or the other.
--
Jonathan "Dataweaver" Lang
Ah, in that sense 'given' is currently considered a loop, and 'when'
is considered a conditional, so it's legal to say
say "halt" when 42 given $answer;
That follows from the recent decision to allow a condition inside a loop
to make it easy to write list comprehensions. (The same decision that
turned 'for' into a map clone, by the way, and made 'if' return () when
false, at least in the absence of an 'else'.)
Larry
Nice. Thank you.
--
Jonathan "Dataweaver" Lang