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

Re: explicitly declare closures???

Thread Previous | Thread Next
From:
merlyn
Date:
August 22, 2001 06:38
Subject:
Re: explicitly declare closures???
Message ID:
m1y9ocdxko.fsf@halfdome.holdit.com
>>>>> "Dave" == Dave Mitchell <davem@fdgroup.co.uk> writes:

Dave> Paul Johnson <paul@pjcj.net> 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
<merlyn@stonehenge.com> <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!

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