develooper Front page | perl.perl6.language | Postings from April 2005

Re: Closure/block/sub multiplier /// Win32 module for Perl6

Thread Previous | Thread Next
From:
Larry Wall
Date:
April 20, 2005 11:26
Subject:
Re: Closure/block/sub multiplier /// Win32 module for Perl6
Message ID:
20050420182558.GB766@wall.org
On Wed, Apr 20, 2005 at 07:17:14PM +0200, Juerd wrote:
: Juerd skribis 2005-04-20 19:09 (+0200):
: > I'm not sure the XX thing will happen, but if it does, it'd be most
: > useful if it wouldn't treat a sub call differently.
: 
: I forgot rationale.
: 
: It shouldn't treat a sub call differently, so that a called sub can in a
: useful manner return a closure, which is then executed several times.
: The same annoying special syntax can be found in perl 5's goto, that
: can't go to a returned subref using "goto sub_that_returns_a_subref();".

Doesn't this work in Perl 5?

    goto &{sub_that_returns_a_subref()};

If not, I'd say it's a bug.

: Which brings me to the following questions:
: 
: Does goto LABEL still exist in Perl 6?
: 
: Must LABEL be quoted/a normal string?

Hmm, well we do still have bare labels for loop control, so I'd
probably still put goto LABEL into the same category.  Overloading
goto in Perl 5 for stack frame replacement was probably a mistake.
These days that should probably be handled with &sub.tailcall(@_) or
some such anyway so that we can confuse it with ordinary tailcall
optimizations.  In fact, that might just be what ordinary tailcall
optimization compiles down to.

Larry

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About