Re: The Block Returns

2003-10-16 Thread Dave Mitchell
On Thu, Oct 16, 2003 at 01:46:30AM +0100, Simon Cozens wrote: > [EMAIL PROTECTED] (Larry Wall) writes: > > But for the time being I'm tied to an IV pole > > We got rid of those; they're PMC poles now. > > Get well soon, Ditto! Dave. -- Little fly, thy summer's play my thoughtless hand has ter

Re: The Block Returns

2003-10-15 Thread Simon Cozens
[EMAIL PROTECTED] (Larry Wall) writes: > But for the time being I'm tied to an IV pole We got rid of those; they're PMC poles now. Get well soon, Simon -- "They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."

Re: The Block Returns

2003-10-15 Thread Larry Wall
"; : $block(); : print "End"; : : That is, the block returns from a function that's not currently : executing. : : Will the output be: a) : : Can't 'return' from closure Block It can't in general be determined at compile time whether the dynamic scope

Re: The Block Returns

2003-10-03 Thread Piers Cawley
Dan Sugalski <[EMAIL PROTECTED]> writes: > At 11:55 PM +0100 10/3/03, Piers Cawley wrote: >>Dan Sugalski <[EMAIL PROTECTED]> writes: >> >>> On Thu, 2 Oct 2003, Mark A. Biggar wrote: >>> Austin Hastings wrote: >>> > But that imposes eval() pretty frequently. Better to provide > s

Re: The Block Returns

2003-10-03 Thread Dan Sugalski
At 11:55 PM +0100 10/3/03, Piers Cawley wrote: Dan Sugalski <[EMAIL PROTECTED]> writes: On Thu, 2 Oct 2003, Mark A. Biggar wrote: Austin Hastings wrote: > But that imposes eval() pretty frequently. Better to provide > some lower-level hackish way to agglutinate Blocks. Isn't this one of the

Re: The Block Returns

2003-10-03 Thread Piers Cawley
Dan Sugalski <[EMAIL PROTECTED]> writes: > On Thu, 2 Oct 2003, Mark A. Biggar wrote: > >> Austin Hastings wrote: > >> > But that imposes eval() pretty frequently. Better to provide >> > some lower-level hackish way to agglutinate Blocks. >> >> >> Isn't this one of the prime examples of why CPS is

Re: The Block Returns

2003-10-03 Thread Dan Sugalski
On Thu, 2 Oct 2003, Mark A. Biggar wrote: > Austin Hastings wrote: > > But that imposes eval() pretty frequently. Better to provide > > some lower-level hackish way to agglutinate Blocks. > > > Isn't this one of the prime examples of why CPS is being use, it allows > for Tail Recursion Optimizati

Re: The Block Returns

2003-10-03 Thread Mark A. Biggar
Austin Hastings wrote: -Original Message- From: Luke Palmer [mailto:[EMAIL PROTECTED] Sent: Thursday, October 02, 2003 10:23 PM To: Jeff Clites Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: The Block Returns Jeff Clites writes: Speaking to the practical side, I have written code

Re: The Block Returns

2003-10-03 Thread Adam D. Lopresto
On Fri, 3 Oct 2003, Simon Cozens wrote: > Dunno what .= would mean now . is method call. I'm sure someone will make it > mean something. :) I've been saying for some time now that .= should mean exactly what one would expect it to mean, method call and assign the result, for code like $str .= lc

Re: The Block Returns

2003-10-03 Thread Dan Sugalski
On Fri, 3 Oct 2003, Simon Cozens wrote: > [EMAIL PROTECTED] (Austin Hastings) writes: > > eval($block) if defined $block; > > I prefer $block.compile.run to eval() They're not quite equivalent -- I think eval's still wrapping a try/catch around the call.

Re: The Block Returns

2003-10-03 Thread Luke Palmer
Simon Cozens writes: > [EMAIL PROTECTED] (Austin Hastings) writes: > > Frankly, I think I'd rather see: > > Some nits: > > > macro atexit($code) is parsed(/{ * }/) { > > Probably just >macro atexit($code) is parsed(//) { > > > $block .= $code; > $block _= $code; $block

Re: The Block Returns

2003-10-03 Thread Simon Cozens
[EMAIL PROTECTED] (Austin Hastings) writes: > Frankly, I think I'd rather see: Some nits: > macro atexit($code) is parsed(/{ * }/) { Probably just macro atexit($code) is parsed(//) { > $block .= $code; $block _= $code; Dunno what .= would mean now . is method call. I'm sure som

Re: The Block Returns

2003-10-02 Thread Luke Palmer
Austin Hastings writes: > > -Original Message- > > From: Luke Palmer [mailto:[EMAIL PROTECTED] > > > > But this is already supported, in its most powerful form: > > > > wrap &block: { call; other_stuff() } > > Hmm, no. > > That does a call, which presumes a return, which burns up > w

RE: The Block Returns

2003-10-02 Thread Austin Hastings
> -Original Message- > From: Luke Palmer [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 02, 2003 10:23 PM > To: Jeff Clites > Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: The Block Returns > > > Jeff Clites writes: > > >Speaking t

Re: The Block Returns

2003-10-02 Thread Luke Palmer
Jeff Clites writes: > >Speaking to the practical side, I have written code that has to > >disentangle > >itself from the failure of a complex startup sequence. I'd love to be > >able > >to build a dynamic exit sequence. (In fact, being able to do &block > >.= > >{ more_stuff(); }; is way up on m

Re: The Block Returns

2003-10-02 Thread Jeff Clites
Speaking to the practical side, I have written code that has to disentangle itself from the failure of a complex startup sequence. I'd love to be able to build a dynamic exit sequence. (In fact, being able to do &block .= { more_stuff(); }; is way up on my list...) I've wanted to do that sort of

RE: The Block Returns

2003-10-02 Thread Austin Hastings
de that returns from the foo() > subroutine (the line that says "return $self") When that closure is > then called ... > > > my $block = foo; > > print "Main"; > > $block(); > > ... foo() is no longer executing. > > &

Re: The Block Returns

2003-10-02 Thread Mark A. Biggar
self; } } foo() returns a closure that contains code that returns from the foo() subroutine (the line that says "return $self") When that closure is then called ... my $block = foo; print "Main"; $block(); ... foo() is no longer executing. That is,

Re: The Block Returns

2003-10-02 Thread Jonathan Scott Duff
print "Block"; > return $self; > } > } foo() returns a closure that contains code that returns from the foo() subroutine (the line that says "return $self") When that closure is then called ... > my $block = foo; > print "Main";

Re: The Block Returns

2003-10-02 Thread Dave Mitchell
On Thu, Oct 02, 2003 at 04:15:06AM -0600, Luke Palmer wrote: > And to clarify: > > sub indexof(Selector $which, [EMAIL PROTECTED]) { > for zip(@data, 0...) -> $_, $index { > when $which { return $index } > } > } > > Which actually creates a closure (well, in th

Re: The Block Returns

2003-10-02 Thread Luke Palmer
e return inside of it returns from indexof. Which is actually very, very nice. So the question is: What happens when indexof isn't on the call chain, but that inner closure is? Luke > >print "Main"; > >$block(); > >print "End"; > > >That is, the block returns from a function that's not currently > >executing. > > Main > Block > End > > is my guess. > > /Stefan

Re: The Block Returns

2003-10-02 Thread Stefan Lidman
print "Main"; > $block(); >print "End"; >That is, the block returns from a function that's not currently >executing. Main Block End is my guess. /Stefan

The Block Returns

2003-10-02 Thread Luke Palmer
So, I must ask, what does this do: sub foo() { return my $self = { print "Block"; return $self; } } my $block = foo; print "Main"; $block(); print "End"; That is, the block returns from a function