Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62583 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66047 invoked from network); 29 Aug 2012 20:10:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Aug 2012 20:10:57 -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:59453] helo=xdebug.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 26/F0-59480-0577E305 for ; Wed, 29 Aug 2012 16:10:57 -0400 Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id 8B67DDE13D; Wed, 29 Aug 2012 21:10:52 +0100 (BST) Date: Wed, 29 Aug 2012 21:10:52 +0100 (BST) X-X-Sender: derick@whisky.home.derickrethans.nl To: Nikita Popov cc: Jared Williams , PHP internals In-Reply-To: Message-ID: References: <20120829162147.QQCM24459.aamtaout04-winn.ispmail.ntl.com@p2> 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, Nikita Popov wrote: > > function &bind(array $keys, array &$row) > > { > > foreach($keys as $key) > > yield $key => $row[$key]; > > } > > > > $row = []; > > $it = bind(['a', 'b'], $row); > > > > foreach($it as $key => &$ref) > > echo $key; > > echo "\n"; > > foreach($it as $key => &$ref) > > echo $key; > > 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?! 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