Larry Wall wrote:
Jonathan Lang wrote:
: Larry Wall wrote:
: >: 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.
:
: 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.

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'.)

Nice.  Thank you.

--
Jonathan "Dataweaver" Lang

Reply via email to