Re: recursive closures?
From: Uri Guttman (uri_at_stemsystems.com)
Date: 12/17/03
- Next message: James Willmore: "Re: Where do -T warnings go?"
- Previous message: user_at_domain.invalid: "Redirect url"
- In reply to: Brian McCauley: "Re: recursive closures?"
- Next in thread: Lukas Mai: "Re: recursive closures?"
- Reply: Lukas Mai: "Re: recursive closures?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 17 Dec 2003 14:42:03 GMT
>>>>> "BM" == Brian McCauley <nobull@mail.com> writes:
>> ------------------------
>>
>> They're not correct.
> Who is "they" here? Damian or "someone".
they being those (you?) who claim that recursive closures will leak.
>> At least, not under 5.8.0 or later (and probably earlier too). And
>> you can verify that by blessing the closure and seeing it die:
> The code you cite demonstrates that destruction will take place if you
> _do_ explicitly break the cirular ref.
that is no difference from $fib going out of scope.
i just changed the code to do just that:
{
my $fib;
$fib = bless sub {
my ($n) = @_;
return 1 if $n < 2;
return $fib->($n-1) + $fib->($n-2);
}, 'Bang';
# Test...
print $fib->(7), "\n";
}
package Bang;
sub DESTROY { print "Bang!\n" }
it prints:
21
Bang!
so it sure looks like it got destroyed upon exiting scope. what more do
you want? i see no leak there
uri
-- Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com --Perl Consulting, Stem Development, Systems Architecture, Design and Coding- Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
- Next message: James Willmore: "Re: Where do -T warnings go?"
- Previous message: user_at_domain.invalid: "Redirect url"
- In reply to: Brian McCauley: "Re: recursive closures?"
- Next in thread: Lukas Mai: "Re: recursive closures?"
- Reply: Lukas Mai: "Re: recursive closures?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|