On Mon, Dec 13, 2010 at 04:33:19PM +0000, Zefram wrote: > Given that (a) there are already multiple versions of this on CPAN, > (b) there are competing versions of the semantics, and (c) it's easy > to implement a new version on CPAN where the existing versions don't > provide the desired semantics, it seems to me that the right place for > this isn't the core, it's CPAN. +1 First off, there's callee http://search.cpan.org/~marcel/callee-1.100820/lib/callee.pm Secondly, if you want it for the purpose of recursive functions, try CPS http://search.cpan.org/~pevans/CPS-0.10/lib/CPS.pm use CPS qw( kwhile ); kwhile( sub { my ( $knext ) = @_; .... $knext->(); } ); It also includes some added magic to not blow up the stack if you call it "synchronously", it turns into a real tailcall implemented by a while loop, so the stack doesn't get consumed. Ofcourse you can also store the $knext closure somewhere else to invoke later. CPS is pure-perl. -- Paul "LeoNerd" Evans leonerd@leonerd.org.uk ICQ# 4135350 | Registered Linux# 179460 http://www.leonerd.org.uk/Thread Previous | Thread Next