Re: Generators in PHP
| From: | Morgan L. Owens | Date: | Fri, 10 Aug 2012 01:01:36 +0000 |
| Subject: | Re: Generators in PHP | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-62112@lists.php.net to get a copy of this message | ||
hakre wrote:
Which (as it happens) reminds me of the difference between return $foo; and return ($foo);Also, currently yield looks very similar to return and I think this is a nice thing as it is similar semantically. yield($foo) would give it different semantics, imho.I love this point a lot. Return is very common and yield is some kind of return. I agree also: yield behaves far more like a return statement than a function call. (In a sense, a yield is a return that doesn't discard the current function's execution state.)