Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60783 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 22330 invoked from network); 8 Jun 2012 11:53:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Jun 2012 11:53:17 -0000 Authentication-Results: pb1.pair.com header.from=ivan.enderlin@hoa-project.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ivan.enderlin@hoa-project.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain hoa-project.net from 95.130.12.24 cause and error) X-PHP-List-Original-Sender: ivan.enderlin@hoa-project.net X-Host-Fingerprint: 95.130.12.24 host1.trois-doubles.net Linux 2.6 Received: from [95.130.12.24] ([95.130.12.24:41747] helo=host1.trois-doubles.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DE/50-20505-AA7E1DF4 for ; Fri, 08 Jun 2012 07:53:15 -0400 Received: from Hwhost2.local (67-24.76-83.cust.bluewin.ch [83.76.24.67]) by host1.trois-doubles.net (Postfix) with ESMTPA id 918C82062C2 for ; Fri, 8 Jun 2012 13:53:11 +0200 (CEST) Message-ID: <4FD1E7A7.5040604@hoa-project.net> Date: Fri, 08 Jun 2012 13:53:11 +0200 Reply-To: ivan.enderlin@hoa-project.net User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:15.0) Gecko/20120606 Thunderbird/15.0a2 MIME-Version: 1.0 To: internals@lists.php.net References: <4FCF2F09.8050904@hoa-project.net> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Generators in PHP From: ivan.enderlin@hoa-project.net ("Ivan Enderlin @ Hoa") Hi Nikita, On 08/06/12 13:16, Nikita Popov wrote: > On Wed, Jun 6, 2012 at 12:20 PM, Ivan Enderlin @ Hoa > wrote: >> In addition to Gustavo's remarks, I wonder how the GC would collect a >> Generator object that is not use anymore (especially with a referenced= >> yield). Does it fit to the current CG strategy or do we need an extra >> strategy? I would notice that the =93Yield by reference=94 section doe= s not >> exist but you have targeted it). > I added a new section which answers the question at least partially: > https://wiki.php.net/rfc/generators#closing_a_generator Good. Thank you. > If you don't need the generator object anymore you can either > explicitly ->close() it or wait until all references to it are removed > (typically when leaving the scope of the calling function). When the > generator is closed it releases all used resources, including the > suspended execution context and the currently yielded value. Whether > or not the value is yielded by reference shouldn't make a difference. > So, yes, the current GC strategy works well for generators too :) Ok. A very naive question: would it be interesting to make the=20 difference between a =93yield=94 and a =93weak referenced yield values=94= (same=20 concept that https://wiki.php.net/rfc/weakreferences which is under=20 voting phase as the RFC said). Thank you for your clarifications. --=20 Ivan Enderlin Developer of Hoa http://hoa.42/ or http://hoa-project.net/ PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis) http://disc.univ-fcomte.fr/ and http://www.inria.fr/ Member of HTML and WebApps Working Group of W3C http://w3.org/