develooper Front page | perl.perl6.language | Postings from August 2001

Re: explicitly declare closures???

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
August 22, 2001 03:48
Subject:
Re: explicitly declare closures???
Message ID:
200108221048.LAA11214@gizmo.fdgroup.co.uk
Paul Johnson <paul@pjcj.net> wrote:
> Try changing your original example from
> 
>   sub foo {
> 
> to
> 
>   *foo = sub {
> 
> and you'll see that everything works "as expected".

add a BEGIN so that instantion happens at the same time that a named
sub would be:

BEGIN { * foo = sub { ....} }

and the problem comes back ;-)

Anyway, coming back to my original suggestion:

I think closures are a lot harder (or at least subtler) than people
think, and explicit declarations might help. There again, they might not.

Ah well....

Dave M.


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