>>>>> "JT" == John Tobey <[EMAIL PROTECTED]> writes:
JT> On Fri, Mar 14, 2003 at 03:49:21PM -0500, Dan Sugalski wrote:
>> At 10:14 AM -0500 3/14/03, Andrew Pimlott wrote:
>> >
>> >A6 says that, as in Perl 5, only anonymous subs are closures. I've
>> >always thought of the fact that Perl 5 named subs are not closures
>> >as a bug kept for compatibility.
>>
>> Well... there's always the issue that closures are done by
>> instantiating the sub at runtime, while named subs are instantiated
>> at compile time, which causes some difficulties. (As the enclosing
>> sub's lexicals instantiate at runtime, thus giving the contained sub
>> nothing to close over)
>>
>> Now, if the named lexically scoped sub actually got re-instantiated
>> every time, *that* would be different.
JT> YES. That's what we want. That is how Scheme and Common Lisp work.
JT> That would make for cleaner code.
well, this is what will be supported which is named nested subs.
it looks to be compiled but callable only from within the outer sub and
it has access to the outer subs vars.
my $c;
sub foo() {
my $a;
my $b;
my sub bar() {
$b = $a + $c;
}
bar();
}
is that close enough?
uri
--
Uri Guttman ------ [EMAIL PROTECTED] -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
Damian Conway Perl Classes - January 2003 -- http://www.stemsystems.com/class
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm