Re: [RFC] Generators
| From: | Alex Aulbach | Date: | Tue, 14 Aug 2012 12:02:17 +0000 |
| Subject: | Re: [RFC] Generators | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-62141@lists.php.net to get a copy of this message | ||
2012/8/13 Anthony Ferrara <ircmaxell@gmail.com>:
> It's absolutely something that takes getting used to. But it's also quite
> intuitive once you think about it. You're not "returning" back to the
> parent scope (exiting your scope), you're "yielding" a value to the parent
> scope, expecting to continue on later (think of it as a stop light where
> you let the other code run for a while until you go to the next one).
I think for people, which are - like me - more used with databases,
the cursor-concept is a good comparison.
Perhaps this could help a little bit to explain it...
--
Alex Aulbach