>>>>> "Dave" == Dave Mitchell <[EMAIL PROTECTED]> writes:

Dave> Paul Johnson <[EMAIL PROTECTED]> 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
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Reply via email to