Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84181 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67335 invoked from network); 2 Mar 2015 19:44:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Mar 2015 19:44:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.48 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.48 mail-wg0-f48.google.com Received: from [74.125.82.48] ([74.125.82.48:33254] helo=mail-wg0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CA/B8-14834-ABDB4F45 for ; Mon, 02 Mar 2015 14:44:58 -0500 Received: by wghb13 with SMTP id b13so35647637wgh.0 for ; Mon, 02 Mar 2015 11:44:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=Qc3fVDKi9f7bXrfYP/9mzoiiumvrnTcU0w+7EQ8sfIc=; b=Oq3m+08DIm8SrG+MWf9SwPO9pG+NhY0KoZZ4jGxiwmF+uRZp0nTzAyd6bBtVpLohgB +iaON4Kd6YMgV/gCfomo23Y4Zw1xO+IDy1WBNM7+QSaY1I5rzK3sIfSE8A1icRp3DLh2 /t63BOqyRSW4/1ni+b0FhRsNnK9wRZA/1z7tDG8ki9ih/HSa3IYDZN2USKM8JESFrTF5 yke+e41oyhXgaM6C/elJfHt6Fxe6l+HQF0SKSdzBEw5LWe5+6le6cqH9BJcEPdzbOYbC nrpGkYxVInn2gJwsfmll1Zo2fEAn4oLg3dYoakAWYOAkQFVL+5IZ8oGJtLEABTske4y5 SSEg== X-Received: by 10.194.63.16 with SMTP id c16mr62779080wjs.117.1425325495068; Mon, 02 Mar 2015 11:44:55 -0800 (PST) Received: from [192.168.0.136] ([62.189.198.114]) by mx.google.com with ESMTPSA id fm10sm17440429wib.7.2015.03.02.11.44.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Mar 2015 11:44:54 -0800 (PST) Message-ID: <54F4BD87.8040202@gmail.com> Date: Mon, 02 Mar 2015 19:44:07 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC Discuss] Generator Delegation From: rowan.collins@gmail.com (Rowan Collins) Daniel Lowrey wrote on 01/03/2015 23:52: > Hi folks, > > I'd like to initiate discussion on a proposal to implement generator > delegation via the following new syntax inside generator functions: > > yield * > > The Generator Delegation RFC is available here: > > https://wiki.php.net/rfc/generator-delegation > > This proposal is conceptually related to (and requires functionality > proposed by) the forerunning Generator Return Expressions RFC here: > > https://wiki.php.net/rfc/generator-return-expressions > > > Thanks for your time, > > Daniel > Could you explain a bit more about how the generator return functionality is necessary for this? It seems to me like it's still just a "nice to have", and that the main functionality - delegating from one generator to another - is completely separate. Or is there some common use case that only makes sense if you combine the two features? The reason I ask is that "yield from" (or whatever syntax) sounds useful, but I'm not that keen on allowing "return" in generators, because I can see it further muddying the water between functions and generators: when you call the following "function", it doesn't actually return 1 as it would appear at a glance, because the existence of a yield statement elsewhere in the body magically makes it return a Generator object instead: function foo() { // potentially many lines of code yield 1; // potentially many more lines of code return 1; } I would personally have preferred generators to have used a distinct keyword rather than just looking like functions, but since that ship has sailed, making them look even more like functions worries me. Is there perhaps some other syntax that could be used for this "generator result value"? Regards, -- Rowan Collins [IMSoP]