Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:38629 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36537 invoked from network); 26 Jun 2008 08:13:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jun 2008 08:13:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=gwynne@wanderingknights.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=gwynne@wanderingknights.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain wanderingknights.org from 208.97.132.74 cause and error) X-PHP-List-Original-Sender: gwynne@wanderingknights.org X-Host-Fingerprint: 208.97.132.74 sd-green-bigip-74.dreamhost.com Received: from [208.97.132.74] ([208.97.132.74:54310] helo=postalmail-a5.g.dreamhost.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 46/93-13482-DAF43684 for ; Thu, 26 Jun 2008 04:13:34 -0400 Received: from [192.168.2.192] (c-24-128-82-179.hsd1.ma.comcast.net [24.128.82.179]) by postalmail-a5.g.dreamhost.com (Postfix) with ESMTP id 868F3BF2EE; Thu, 26 Jun 2008 01:13:30 -0700 (PDT) Cc: Christian Seiler , Andi Gutmans , php-dev List Message-ID: <96947279-8160-44EE-89FF-E85CBA25B71A@wanderingknights.org> To: Lukas Kahwe Smith In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v924) Date: Thu, 26 Jun 2008 04:13:22 -0400 References: <4856A547.3080801@gmx.net> <698DE66518E7CA45812BD18E807866CE01B11811@us-ex1.zend.net> <4858FCC7.5030305@gmx.net> X-Mailer: Apple Mail (2.924) Subject: Re: [PHP-DEV] [PATCH] [RFC] Closures and lambda functions in PHP From: gwynne@wanderingknights.org (Gwynne Raskind) On Jun 26, 2008, at 4:06 AM, Lukas Kahwe Smith wrote: >> Now, upon execution of the code containing the closure, the new >> opcode >> just copies the zend_function structure into a copy, registers that >> copy >> as a resource and returns that resource. As soon as the resource is >> garbage collected (or explicitly unset), the op_array copy is >> destroyed. >> No modification of the actual class is done at all - the cache >> remains >> happy. > So since a reference is stored, it means that the destructor of the > enclosing object is only called once not only the variable holding > the object, but also all lambda functions that were created inside > of the class have been free'ed? I'm not up to date on the operation of the current patches to implement closures, but typically this is how it'd work, retaining references to what's needed as long as the closures exist. -- Gwynne, Daughter of the Code "This whole world is an asylum for the incurable."