Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62593 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12713 invoked from network); 30 Aug 2012 08:27:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Aug 2012 08:27:58 -0000 Authentication-Results: pb1.pair.com header.from=derick@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=derick@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 82.113.146.227 as permitted sender) X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.113.146.227 xdebug.org Linux 2.6 Received: from [82.113.146.227] ([82.113.146.227:40511] helo=xdebug.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1D/51-02911-9042F305 for ; Thu, 30 Aug 2012 04:27:56 -0400 Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id A0040DE13E; Thu, 30 Aug 2012 09:27:50 +0100 (BST) Date: Thu, 30 Aug 2012 09:27:50 +0100 (BST) X-X-Sender: derick@whisky.home.derickrethans.nl To: Stas Malyshev cc: Nikita Popov , Hannes Magnusson , Jared Williams , PHP internals In-Reply-To: <503E7FF1.40607@sugarcrm.com> Message-ID: References: <20120829162147.QQCM24459.aamtaout04-winn.ispmail.ntl.com@p2> <503E7FF1.40607@sugarcrm.com> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] [VOTE] Generators From: derick@php.net (Derick Rethans) 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