Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

statement modifiers

11 views
Skip to first unread message

Jonathan Lang

unread,
Mar 4, 2007, 11:55:28 PM3/4/07
to p6l
The text of S02, S03, and S04 still contain references to the
now-defunct "statement_modifier" grammatical category.

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

Larry Wall

unread,
Mar 5, 2007, 12:35:06 AM3/5/07
to Jonathan Lang, p6l
On Sun, Mar 04, 2007 at 08:55:28PM -0800, Jonathan Lang wrote:
: The text of S02, S03, and S04 still contain references to the
: now-defunct "statement_modifier" grammatical category.

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

Jonathan Lang

unread,
Mar 5, 2007, 12:44:59 AM3/5/07
to p6l
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.

--
Jonathan "Dataweaver" Lang

Larry Wall

unread,
Mar 5, 2007, 12:53:51 AM3/5/07
to p6l

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

Jonathan Lang

unread,
Mar 5, 2007, 1:00:44 AM3/5/07
to p6l

Nice. Thank you.

--
Jonathan "Dataweaver" Lang

0 new messages