Re: Generators in PHP

From: Date: Fri, 10 Aug 2012 01:01:36 +0000
Subject: Re: Generators in PHP
Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
hakre wrote:

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.)
Which (as it happens) reminds me of the difference between return $foo; and return ($foo);

Thread (142 messages)

« previous php.internals (#62112) next »