On Nov 2, Paul Johnson said:

>> can be called a closure.  I feel that "closure" refers more to the action,
>> and less to the means -- we are creating a subroutine (named or unnamed
>> makes no difference) which holds on to variables that "should" be gone.

First, I have to thank you for taking the effort you just did.  It's nice
to see it.

>1.  The current documentation refers to closures as anonymous
>    subroutines.  It doesn't state that named subroutines can not be
>    closures, but it does always state that closures are anonymous
>    subroutines, if it makes any distinction.

Right.  I happen to disagree with it. :)

>2.  Damian Conway's excellent "Object Oriented Perl" explicitly states
>    that named subroutines can be closures.

And so does The Damian.  (And the Randal, for that matter.)

>3.  Currently, Perl exhibits some surprising behaviour in certain
>    situations when a named subroutine is being used as a closure.  In
>    practice, Perl does not properly close named subroutines.  Most
>    people holding an opinion consider this a bug, although there is not
>    general consensus, and it is difficult to fix anyway.  There are no
>    such caveats when using anonymous subroutines as closures.

What are the problems with named subroutines being used as closures?
Could you provide some test cases?

>4.  Ideally, I would like to see both Perl and its documentation patched
>    such that named subroutines can be safely used as closures.  There
>    are probably but a handful of people capable of doing that, and so
>    far it has not been done.

We'll see.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to