> Am 02.03.2015 um 01:17 schrieb Niklas Keller <m...@kelunik.com>:
> 
> 2015-03-02 0:52 GMT+01:00 Daniel Lowrey <rdlow...@php.net>:
> 
>> Hi folks,
>> 
>> 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
>> 
>> 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:
> 
> <?php
> 
> function a () {
>    echo yield * 3;
> }
> 
> $a = a();
> $a->send(42);
> 
> http://3v4l.org/n1sGb#v550
> 
> This is currently valid PHP.
> 
> Regards, Niklas

Hey,

I think we could use "yield from" as operator here.

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 … and in case this breaks someones 
code, he needs to wrap the constant in parenthesis: "yield (from)".

We can have nice syntax here with a minimal break, so, then, why not?

Thanks,
Bob
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to