Re: [PATCH] [RFC] Closures and lambda functions in PHP
| From: | Marcus Boerger | Date: | Sat, 21 Jun 2008 17:07:33 +0000 |
| Subject: | Re: [PATCH] [RFC] Closures and lambda functions in PHP | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-38496@lists.php.net to get a copy of this message | ||
Hello Stanislav,
Friday, June 20, 2008, 7:44:10 PM, you wrote:
> Hi!
>> As one of the Haskell list denizens commented, is there a potential for memory
>> leakage if lambdas implicitly import $this when defined within an object
> Not really leakage (if refcounts done right) but lifetimes extending
> beyond what is expected - i.e. if some instance of closure generated by
> the object is alive then the object is alive. If that's an issue, it can
> be improved by storing $this only for closures that actually use it
> (those messing with $$var will be in trouble).
Your point being? You describe nothing new here. Just admit the fact once
again that refcounted variables are a) hard to implement correct and b)
never work 100% what you want. A GC simply isnt an artifical intelligence
that knows wht you would like it to do when reference counting gets more
complex. We know this arelready and we live with this in PHP for a long
time. And it is never a real problem in the domain we focus on. That being
short living scripts that serve internet requests.
Best regards,
Marcus