>>>>> "Randal" == Randal L Schwartz <[EMAIL PROTECTED]> writes:

>>>>> "Jeff" == Jeff Pinyan <[EMAIL PROTECTED]> writes:
Jeff> A closure is an ANONYMOUS function (constructed via $x = sub {
Jeff> ... }) that contains LEXICAL variables that have been defined in
Jeff> a scope visible to the closure itself.

Randal> leave out the word ANONYMOUS there.

Randal> ANONYMOUS and CLOSURE are orthogonal.

Randal> in "BEGIN { my $x; sub foo { ... $x ... } }", foo is a CLOSURE
Randal> and is not ANONYMOUS.

In fact, a closer definition is probably:

    A closure is a subroutine that would have persisted beyond the
    lexical variables it uses, but instead extends the lifetime of
    those variables to at least match its own.

-- 
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