Hi!
> https://wiki.php.net/rfc/generators#yield_keyword > https://wiki.php.net/rfc/generators#sending_values I'm not sure $data = (yield $value) makes a lot of sense. Why we have two variables here? Why it is only operator in the language that requires parentheses around? All these complex parentheses rules seem unnecessarily complicated. I'd rather do it in a more simple way: yield in an expression means incoming yield. I.e.: $data = yield; foo(yield, 1, 2); list($a, $b) = yield; Same with: call(yield $value) - what is the meaning of $value here? Why not just call(yield)? I would also not support array((yield $key => $value)) - it seems to be really unclear how it works. I'd just have yield produce a value which was sent, and that's it, and you could use this value in the same way you'd use any other expression. Only question I have here is what happens if you use yield in the middle of function call expression, for example: call(foo(bar(), $foo, yield, 3), baz()); We are kind of stopping the function in the middle of the function call and going to unrelated code here, and may never return back. Where the required cleanups, etc. should happen? Another question is, if my function is like this: function foo() { var_dump(yield); } And I do: foo()->current() - what happens? Do I get null there? What happens if after that I do send() on the same generator? In general, interaction between incoming and outgoing yields is not very clear, especially what happens when you combine them. Also, small point: yield is repeatably called "statement" in the doc, but in fact it can be both statement and expression with returning yield. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php