On Fri, 13 Aug 2004 10:46:45 -0700, Larry Wall <[EMAIL PROTECTED]> wrote:
> This maps pretty well onto Ruby's magic blocks
> (and admittedly was inspired by it), though Perl will have different
> syntactic rules about how to pass one, of course, because we're
> generalizing the concept somewhat.  In particuler, one way to pass
> a magic block is as an anonymous adverb: C<< :{...} >>.  I suspect
> it can also be passed as the final element on the slurpy list,
> from which it could be removed at either compile time or call time.
> Or it could be passed as an explicitly named parameter.  That's
> what I mean by generalizing Ruby's concept--there's no "magic" syntax
> for blocks--it's just another named parameter, where the name can
> sometimes be omitted on the call.  It's always declared with a name
> on the receiving end, and there's no magic "yield" on an implicit
> closure.  Just call the named closure.

All this talk of blocks and Ruby (and A12 Lookahead Notions) brings up
an important question in my mind: how will Perl 6 handle multiple
blocks? When using Ruby, I found blocks both easy and pretty. But I
found writing a method with multiple blocks to be both less easy and
less pretty.

>From what I understand, something like this will be possible (but will
it need parens?):

 @array.each :odd{ $^odd.bar() } :even{ $^even.baz() };

But what about this?

 @array.each:{$^odd.bar() }:{ $^even.baz() };

Admittedly it's a much smaller case, but it should be useful, even if
I can't think of a non trivial case offhand.

-- 
matt diephouse
----------------------
http://matt.diephouse.com

> 
> Larry
>

Reply via email to