Re: Handling block parameters in Ruby

2004-08-14 Thread mark sparshatt
Larry Wall wrote: On Fri, Aug 13, 2004 at 02:12:06PM +0100, mark sparshatt wrote: : My main worry with this approach is how it would interact with slurpy : args. I mean if method is defined as : : def method(*args) : ... : end : : how do I make sure that $clos doesn't become part of args? In Pe

Re: Handling block parameters in Ruby

2004-08-13 Thread Larry Wall
On Fri, Aug 13, 2004 at 08:41:35PM -0400, Matt Diephouse wrote: : > You know, at some point you just break down and write them positionally: : > : > @array.each( { $^odd.bar() }, { $^even.baz() }); : : Speaking of which, let's talk a little bit about how I'd write these : methods. After looki

Re: Handling block parameters in Ruby

2004-08-13 Thread Matt Diephouse
On Fri, 13 Aug 2004 11:36:05 -0700, Larry Wall <[EMAIL PROTECTED]> wrote: > Yes, that's precisely why I'm trying to generalize Ruby's single > "magic" block into one or more ordinary parameters. Excellent. :) > Two anonymous adverbs? Hmm. While I can think of ways to force it to > work, I'm inc

Re: Handling block parameters in Ruby

2004-08-13 Thread Brent 'Dax' Royal-Gordon
On Fri, 13 Aug 2004 11:44:28 -0400, Dan Sugalski <[EMAIL PROTECTED]> wrote: > Still, I think it might be worth dedicating a slot to it. It's a > handy feature, and if we open it up to perl & python I'd bet we'd see > them using it. This makes we wonder if we shouldn't generalize the concept of the

Re: Handling block parameters in Ruby

2004-08-13 Thread Larry Wall
On Fri, Aug 13, 2004 at 02:21:30PM -0400, Matt Diephouse wrote: : 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

Re: Handling block parameters in Ruby

2004-08-13 Thread Matt Diephouse
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. I

Re: Handling block parameters in Ruby

2004-08-13 Thread Larry Wall
On Fri, Aug 13, 2004 at 02:12:06PM +0100, mark sparshatt wrote: : My main worry with this approach is how it would interact with slurpy : args. I mean if method is defined as : : def method(*args) : ... : end : : how do I make sure that $clos doesn't become part of args? In Perl 6 circles we've

Re: Handling block parameters in Ruby

2004-08-13 Thread Dan Sugalski
At 1:00 PM +0200 8/13/04, Leopold Toetsch wrote: mark sparshatt wrote: I'd like advice on how to handle method invocations that include special block parameters such as method() {do something} The idea is to turn the block into a closure pmc. The problem is how to pass this to the method, so tha

Re: Handling block parameters in Ruby

2004-08-13 Thread mark sparshatt
Leopold Toetsch wrote: mark sparshatt wrote: I'd like advice on how to handle method invocations that include special block parameters such as method() {do something} The idea is to turn the block into a closure pmc. The problem is how to pass this to the method, so that it knows that it's a spe

Re: Handling block parameters in Ruby

2004-08-13 Thread Leopold Toetsch
mark sparshatt wrote: I'd like advice on how to handle method invocations that include special block parameters such as method() {do something} The idea is to turn the block into a closure pmc. The problem is how to pass this to the method, so that it knows that it's a special block parameter.