On Nov 2, Etienne Marcotte said:

>check out http://www.crusoe.net/~jeffp/articles/pm/2000-05.html
>
>a really good document on closures...

Before I get a barrage of "BUT THAT'S NOT A CLOSURE!" let me say this.  I
was told that by someone (can't remember who), and I asked merlyn (Randal) 
what he thought (right, Randal?) and he said that a function like:

  {                       # $name exists ONLY in this block
    my $name = "Jeff";    # $name is lexically scoped
    sub whoami { $name }  # we use the lexical $name here...
  }                       # $name goes out of scope

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.

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