Re: recursive closures?

From: Uri Guttman (uri_at_stemsystems.com)
Date: 12/15/03


Date: Mon, 15 Dec 2003 16:27:39 GMT


>>>>> "BM" == Brian McCauley <nobull@mail.com> writes:

> Uri Guttman <uri@stemsystems.com> writes:
>> my $sub ;
>> $sub = sub{ blah; $sub->() }

> That leaks.

it isn't real code anyhow. i don't recall if damian's leaked or he
weakened it.

> use Scalar::Util qw( weaken );
> my $weak_sub;
> my $sub = sub{ blah; $weak_sub->() }
> weaken($weak_sub = $sub);

it would only leak if you let it fall out of scope without destroying it
(but how?).

and i can't seem to find damian's stuff on google. i will email him
about it.

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


Relevant Pages

  • Re: OT Repaired plastic gas tank (cpsc.gov recall list)
    ... My lawnmower plastic gas tank sprung a small leak, ... Pressurized the tank to lung pressure. ... the www.cpsc.gov website and they had a recall on honda lawnmowers because ...
    (rec.crafts.metalworking)
  • Re: OT Repaired plastic gas tank (cpsc.gov recall list)
    ... My lawnmower plastic gas tank sprung a small leak, ... Pressurized the tank to lung pressure. ... the www.cpsc.gov website and they had a recall on honda lawnmowers because ...
    (rec.crafts.metalworking)
  • Re: SGI introduced a bug in 7.41 compiler?
    ... referenced once in a rename-list any particular scope. ... Seems to me that I recall something vaguely similar mentioned in the ... what compiler or exactly what code, but I do recall a compiler ... complaining about conflicts in a scoping unit when the things in ...
    (comp.lang.fortran)
  • Re: Infallibility or inability?
    ... >> And let us recall that Jim was not the source of the leak ... ... > It was not 'his "private" letter. ... I was actually expanding upon the fact that Jim was not the source of the ...
    (talk.religion.bahai)
  • Re: recursive closures?
    ... they being those who claim that recursive closures will leak. ... that is no difference from $fib going out of scope. ... so it sure looks like it got destroyed upon exiting scope. ...
    (comp.lang.perl.misc)