Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84163 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84214 invoked from network); 2 Mar 2015 10:41:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Mar 2015 10:41:52 -0000 Authentication-Results: pb1.pair.com header.from=bobwei9@hotmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=bobwei9@hotmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hotmail.com designates 65.55.111.107 as permitted sender) X-PHP-List-Original-Sender: bobwei9@hotmail.com X-Host-Fingerprint: 65.55.111.107 blu004-omc2s32.hotmail.com Received: from [65.55.111.107] ([65.55.111.107:51857] helo=BLU004-OMC2S32.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6A/85-48321-E6E34F45 for ; Mon, 02 Mar 2015 05:41:51 -0500 Received: from BLU436-SMTP171 ([65.55.111.72]) by BLU004-OMC2S32.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.22751); Mon, 2 Mar 2015 02:41:48 -0800 X-TMN: [uq3CgPTdBMU5ZNLfKy4uTz2nwC9CJOTN] X-Originating-Email: [bobwei9@hotmail.com] Message-ID: Content-Type: multipart/alternative; boundary="Apple-Mail=_DD21C1A1-577E-4EA9-BD52-124089FB50DA" MIME-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) In-Reply-To: Date: Mon, 2 Mar 2015 11:41:43 +0100 CC: Daniel Lowrey , "internals@lists.php.net" References: To: Niklas Keller X-Mailer: Apple Mail (2.2070.6) X-OriginalArrivalTime: 02 Mar 2015 10:41:45.0735 (UTC) FILETIME=[7AB76170:01D054D5] Subject: Re: [PHP-DEV] [RFC Discuss] Generator Delegation From: bobwei9@hotmail.com (Bob Weinand) --Apple-Mail=_DD21C1A1-577E-4EA9-BD52-124089FB50DA Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" > Am 02.03.2015 um 11:28 schrieb Niklas Keller : > 2015-03-02 11:11 GMT+01:00 Bob Weinand >: > > Am 02.03.2015 um 01:17 schrieb Niklas Keller >: > > > > 2015-03-02 0:52 GMT+01:00 Daniel Lowrey >: > > > >> 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 > >> > > > > The proposed syntax has an issue: > > > > > > > function a () { > > echo yield * 3; > > } > > > > $a =3D a(); > > $a->send(42); > > > > http://3v4l.org/n1sGb#v550 > > > > This is currently valid PHP. > > > > Regards, Niklas >=20 > Hey, >=20 > I think we could use "yield from" as operator here. >=20 > Yes, BC. So, I won't make "from" a keyword, but rather specify an own = token for "yield from" (T_YIELD_FROM). > That way we have no BC break, except someone tries to yield a constant = named "from". I think that's a really minor break =E2=80=A6 and in case = this breaks someones code, he needs to wrap the constant in parenthesis: = "yield (from)". >=20 > We can have nice syntax here with a minimal break, so, then, why not? >=20 > Thanks, > Bob >=20 > If those keywords can be combined to one, that would be totally fine. > I think BC breaks are less a problem when the lexer RFC passes, but = that shouldn't lead to a lot more keyboards being added. > So yield from will be totally fine, it's already used in other = languages. >=20 > Regards, Niklas As said, I won't add a "from" keyword. It's just the combination of = "yield" and "from" with will be interpreted differently at lexer level. And yes, that's how e.g. Python calls it too, hence this suggestion. Bob= --Apple-Mail=_DD21C1A1-577E-4EA9-BD52-124089FB50DA--