Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:38496 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92559 invoked from network); 21 Jun 2008 17:08:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jun 2008 17:08:08 -0000 Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.214.94.56 as permitted sender) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 85.214.94.56 aixcept.net Linux 2.6 Received: from [85.214.94.56] ([85.214.94.56:59613] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FB/AD-26505-6753D584 for ; Sat, 21 Jun 2008 13:08:08 -0400 Received: from MBOERGER-ZRH.corp.google.com (229-103.106-92.cust.bluewin.ch [92.106.103.229]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id 15F5E11DB75; Sat, 21 Jun 2008 19:08:04 +0200 (CEST) Date: Sat, 21 Jun 2008 19:07:33 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <185218061.20080621190733@marcus-boerger.de> To: Stanislav Malyshev CC: Larry Garfield , internals@lists.php.net In-Reply-To: <485BEC6A.1020209@zend.com> References: <4856A547.3080801@gmx.net> <7E.CB.10717.56C7A584@pb1.pair.com> <485B5BCC.1060003@city.ee> <200806200729.40623.larry@garfieldtech.com> <485BEC6A.1020209@zend.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP From: helly@php.net (Marcus Boerger) 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