Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59345 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98124 invoked from network); 3 Apr 2012 14:06:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Apr 2012 14:06:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.170 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.216.170 mail-qc0-f170.google.com Received: from [209.85.216.170] ([209.85.216.170:38583] helo=mail-qc0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BB/B0-24887-4F30B7F4 for ; Tue, 03 Apr 2012 10:06:45 -0400 Received: by qcmt36 with SMTP id t36so2470451qcm.29 for ; Tue, 03 Apr 2012 07:06:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=K8BJfHd8h6IeQzFWPU5EEhEyoSfQdqwK5qq1i3t/K/o=; b=Gx1o1vLj4XtgOrrnGMoVeSRAcZxYUh8QizVRM+nbKxcPifRKckAuuJzkmhwXIcT+J1 btuGE1DNz30Cv2URc+G9IvvNxC3zFu28KtjqDgAgn2zBmdr+InI5+nYKFxZ7jeFxeqt8 p7UOJ+WDF0ONf7u6MefpxpS6JVrngi2ipJZnmOXurr49mJaGMzO1vOF8dvm7EHlImwCT UYlpSvIt7zRG5fYYpaNlClBKoPHfQtm8josmRjyrXBRyTMO+7DBjyCY0SQP01cW+Rv2M cWn+qT3hekYPaz+pNBMTbzlPe2lSemkqCRvvg/9O3acB2yv9S4aSiAZwSjPreo6KVc2+ zpNw== MIME-Version: 1.0 Received: by 10.224.31.197 with SMTP id z5mr2861000qac.26.1333462002103; Tue, 03 Apr 2012 07:06:42 -0700 (PDT) Received: by 10.229.42.4 with HTTP; Tue, 3 Apr 2012 07:06:41 -0700 (PDT) In-Reply-To: References: Date: Tue, 3 Apr 2012 10:06:41 -0400 Message-ID: To: Samuel Giles Cc: Rasmus Schultz , internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] resume after exception From: ircmaxell@gmail.com (Anthony Ferrara) Sam, Just to be clear, I wasn't opposing pythonic generators. I was opposing using this feature for that purpose. If we wanted generators, I would suggest implementing them fully (as in adding a `yield` statement). However, that's not going to be as easy as it sounds, since what would happen with a function like this: function foo(array &$array) { foreach ($array as $value) { yield $value; } } $array =3D array(1); foreach (foo($array) as $value) { $array[] =3D $value + 1; } Not saying it's not doable, just that it's not trivial to implement... Anthony On Mon, Apr 2, 2012 at 5:51 PM, Samuel Giles wrote: > Hi Anthony, > > Ok, I see that now. I know you're not necessarily saying what's been > proposed is a good idea but I can see a benefit in pythonic style generat= ors > as a separate piece of functionality, implementing a yield function, has > this ever been discussed before? My apologies if this is the case I've no= t > seen it since I've been following this list. > > I know there is the SPL Iterator, but just as in the example you provided > implementations *can* be verbose and convoluted. > > Cheers, > Sam > > On Mon, Apr 2, 2012 at 10:34 PM, Anthony Ferrara > wrote: >> >> Sam, >> >> I'm not saying it's a good idea, but this would allow for pythonic >> style generators. =A0http://wiki.python.org/moin/Generators >> >> Just pointing out one potential use-case... >> >> Anthony >> >> On Mon, Apr 2, 2012 at 4:35 PM, Samuel Giles >> wrote: >> > My major concern would be, how does this* really* add to PHP? =A0Perha= ps >> > I'm >> > missing the point, but what would this allow that can't be done in som= e >> > form using well defined "patterns", for lack of a better word. >> > >> > I'm not keen on the idea of throwing things such as Interrupts either, >> > it >> > doesn't quite fit with their general use case. >> > >> > Sam > >