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

Re: explicitly declare closures???

Thread Previous | Thread Next
August 22, 2001 06:38
Re: explicitly declare closures???
Message ID:
>>>>> "Dave" == Dave Mitchell <> writes:

Dave> Paul Johnson <> wrote:
>> Actually, foo() is not a closure.  A closure is an anonymous subroutine
>> and foo() clearly has a name.

Dave> Damain's definition of a closure includes named subs:

Dave> "In Perl, a closure is just a subroutine that refers to one or
Dave> more lexical variables declared outside the subroutine itself" -
Dave> OO perl, p 56.

Exactly.  "closure" and "anonymous" are orthogonal concepts.  An anon
sub is not necessarily a closure.  A closure is not necessarily an
anon sub.  Unfortunately, there were some casual misuses of the terms
early on, and it stuck into some of the early docs and mindsets.

Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<> <URL:>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See for onsite and open-enrollment Perl training!

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About