Re: [VOTE] Generators
| From: | Derick Rethans | Date: | Thu, 30 Aug 2012 08:27:50 +0000 |
| Subject: | Re: [VOTE] Generators | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-62593@lists.php.net to get a copy of this message | ||
On Wed, 29 Aug 2012, Stas Malyshev wrote:
> >> Thanks, this is now fixed. It'll throw an exception now, saying
> >> that you can't traverse an already closed generator.
> >
> > Nothing in the core throws an exception, why would this?!
>
> I'd rather have it skip foreach, maybe producing a warning/notice.
> It'd otherwise also be only place generators throw exceptions, which
> is a bit unexpected.
Indeed. Even though yield/generator is an iterator *internally*,
nothing on the language syntax side hints at that. Nothing even
indicates you're using "OO" there.
This is unlike the SplIterators where are you are clearly constructing
fancy objects.
cheers,
Derick
--
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug
Posted with an email client that doesn't mangle email: alpine