Re: [RFC Discuss] Generator Delegation
| From: | Daniel Lowrey | Date: | Mon, 02 Mar 2015 14:46:30 +0000 |
| Subject: | Re: [RFC Discuss] Generator Delegation | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-84169@lists.php.net to get a copy of this message | ||
On Mon, Mar 2, 2015 at 1:34 AM, Patrick Schaaf <php@bof.de> wrote:
>
> Am 02.03.2015 00:52 schrieb "Daniel Lowrey" <rdlowrey@php.net>:
> >
> > I'd like to initiate discussion on a proposal to implement generator
> > delegation via the following new syntax inside generator functions:
> >
> > yield * <expr>
> >
> > The Generator Delegation RFC is available here:
> >
> > https://wiki.php.net/rfc/generator-delegation
>
> I like the feature. The syntax is awful. What about "yield use (expr)"?
No new keywords, somewhat gramatical, and currently invalid syntax, as far
as I can tell.
IMO
yield use (expr) is awful. Let's note here the unhelpful nature of
adjectives like "awful" in technical discussions.
That said, I have no special attachment to yield *. As noted in the RFC,
yield * is the syntax used in JavaScript generator delegation. I do see
value in using common idioms for existing functionality in other languages.
However, I also appreciate how the Python variation yield from is both
immediately readable and perhaps easier to understand. Pending any
implementation difficulties I'm indifferent between yield from and `yield
*`.
I think the functionality is the important thing to take away here; the
syntax can be whatever folks want it to be.