Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62145 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14913 invoked from network); 14 Aug 2012 15:39:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Aug 2012 15:39:47 -0000 Authentication-Results: pb1.pair.com smtp.mail=hanskrentel@yahoo.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=hanskrentel@yahoo.de; sender-id=unknown; domainkeys=good Received-SPF: error (pb1.pair.com: domain yahoo.de from 77.238.189.58 cause and error) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: hanskrentel@yahoo.de X-Host-Fingerprint: 77.238.189.58 nm1.bullet.mail.ird.yahoo.com Received: from [77.238.189.58] ([77.238.189.58:28993] helo=nm1.bullet.mail.ird.yahoo.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0B/DB-00812-2417A205 for ; Tue, 14 Aug 2012 11:39:47 -0400 Received: from [77.238.189.51] by nm1.bullet.mail.ird.yahoo.com with NNFMP; 14 Aug 2012 15:39:43 -0000 Received: from [212.82.108.119] by tm4.bullet.mail.ird.yahoo.com with NNFMP; 14 Aug 2012 15:39:43 -0000 Received: from [127.0.0.1] by omp1028.mail.ird.yahoo.com with NNFMP; 14 Aug 2012 15:39:43 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 657330.58996.bm@omp1028.mail.ird.yahoo.com Received: (qmail 96397 invoked by uid 60001); 14 Aug 2012 15:39:43 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1344958783; bh=9nUjNQ/lmuw2wHu9AsASjz+/leFRY0nO2zFSaf2Dijw=; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=0xdgipq9KLSMnEVtYmpNAMySgr4ZLKfy2hblqh0cjQntHjteNiIXJTUFRyrJNLf98T+IEPjgI9pQqx0JTpdw0d1mzLcVCS262diTUTjxkbWNDQa76mH3ZMMCssE9geSzb7RkZ7pyzi2Ht1UJQCX10SkA/WQX/mwWrfYoXmFrj5k= DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.de; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=FrQTabJld8bibqnIIge7K03uQ/4w92S7+V57h5Kc0JXqDL3bYkC9heiYG1sbI5awyaLIGjMLZE+hGkfW1P+MY0+waFoWrDtcSbNod4Ir0TipMYLLoiZMVCV6GQkgCZpv0X17MU8VcPc3pWgm78qe2r+ZMpRl7arH3OJfEkf4JuU=; X-YMail-OSG: L9kfdCwVM1nbJ4RaLPhalrFJ5kNEPCVmwbi93_ek_JDN6to ugU0_7aOpk0AWsUB6afJdsmMqCpRCwX9iK.1O1ooErZijkHh_5DP_R.YSWjP clkLQVVv85iAMG2knW9qe7xw7mj_nofAtGOCpMZ4VMqmxirABC2foHZPwcUW Cq2ANPT5NkUNAVBYWA0IFhPIPcsUYeUAudWTnGgsyW05lLZ2Z7B.HNdTeq_H NNqdxRrIXIVU2389N1GHskwDmnPwFne.JKdZpKRmhi8UCnBQJ9iIF0eIx9XH wUzyqCRrPwXwvatwElEC_ywPZAUq0GfihcJsJG18M7e_cMC5Aa6ZncixRqvl Du.VJvvjEC5syzFxqmfooc7us9CZzt3G.ekaJ7psW2UDe_YYHOeq3d89TdgI nYgeN_xDBcTmrDQgnEQqUQK7x2LY._SbC5awKkk1z7tmKRLea2VxVEHYx_qi aLXN2JyMau.uMOFSR76YDw_EjhBiY37zi4GQDtjPrs4ZE87Xl6vgk2zKhwA- - Received: from [84.132.114.248] by web133003.mail.ir2.yahoo.com via HTTP; Tue, 14 Aug 2012 16:39:43 BST X-Mailer: YahooMailWebService/0.8.120.356233 References: <50280D37.10109@moonspot.net> Message-ID: <1344958783.95557.YahooMailNeo@web133003.mail.ir2.yahoo.com> Date: Tue, 14 Aug 2012 16:39:43 +0100 (BST) Reply-To: hakre To: Nikita Popov , "brian@moonspot.net" Cc: "internals@lists.php.net" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Generators From: hanskrentel@yahoo.de (hakre) If I may chime in, not all iterators support rewind, at least not as outlin= ed.=0A=0AThere exists also the NoRewindIterator which you can just use to d= ecorate an iterator out of a generator to not make it do a fatal.=0A=0AHowe= ver as far as a generator is concerned, it probably should just behave like= NoRewindIterator already so not give any errors on rewind. Because you can= not rewind what you can not rewind. No need to error, no need to do someth= ing. The function is just there because of the interface, but it must not d= o anything.=0A=0AIf different behavior is needed it could be decorated, but= right now I can not imagine why rewind would be called (apart from using i= n foreach() for the first time which implies a rewind and that one is alrea= dy like I suggest.)=0A=0A=0AMy 2 cents.=0A=0A-- hakre=0A=0A=0A=0A----- Ursp= r=FCngliche Message -----=0A> Von: Nikita Popov =0A> = An: Brian Moon =0A> CC: PHP internals =0A> Gesendet: 18:09 Montag, 13.August 2012=0A> Betreff: Re: [PHP-D= EV] [RFC] Generators=0A> =0A> On Sun, Aug 12, 2012 at 10:08 PM, Brian Moon = wrote:=0A>> Also, not allowing rewinding is unintuiti= ve for something that is an=0A>> iterator in PHP. If I can foreach() it an= d I can call next() on it, I =0A> expect=0A>> to be able to reset() it as = well. IMO, you would need to issue a FATAL PHP=0A>> error if that simply i= s not allowed. Or you have to have a second syntax =0A> for=0A>> what to d= o in that case. At that point, you are implementing Iterator.=0A> =0A> Curr= ently I'm planning to implement the following behavior for rewind():=0A> = =0A> * If before first yield: Resume to first yield (this priming behavior= =0A> is common to all the Iterator methods)=0A> * At first yield: No-op=0A>= * After first yield: Recoverable fatal error=0A> =0A> So this would allow = you to call ->rewind() after creating the=0A> generator, but will throw an = error if you try to do so later.=0A> =0A> Another thing that I'd like to do= is drop the ->close() method. It=0A> doesn't really make sense to explicit= ly close generators.=0A> =0A> Any objects to those two things?=0A> =0A> Nik= ita=0A> =0A> -- =0A> PHP Internals - PHP Runtime Development Mailing List= =0A> To unsubscribe, visit: http://www.php.net/unsub.php=0A>