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

Questions about statement modifiers

4 views
Skip to first unread message

Agent Zhang

unread,
Aug 30, 2006, 1:37:33 AM8/30/06
to p6l
Hi, there~

I think S04 says too little about statement modifiers. Please comment
on the following code samples. Are they valid Perl 6?

do { say } for 1..3;

{ say } for 1..3;

-> $i { say $i } for 1..3;

And how about similar variations for other statement modifiers, such
as while, given, if, until, and unless?

Thanks!

Agent

Larry Wall

unread,
Sep 1, 2006, 12:14:54 PM9/1/06
to p6l
On Wed, Aug 30, 2006 at 01:37:33PM +0800, Agent Zhang wrote:
: Hi, there~

:
: I think S04 says too little about statement modifiers. Please comment
: on the following code samples. Are they valid Perl 6?
:
: do { say } for 1..3;

The do-BLOCK construct does not allow statement modifiers.

: { say } for 1..3;


:
: -> $i { say $i } for 1..3;

These are both legal syntactically, but neither of these do anything
other than produce a closure muliple times without calling it.

: And how about similar variations for other statement modifiers, such


: as while, given, if, until, and unless?

Same. Will clarify S04.

Larry

0 new messages