Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62112 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81314 invoked from network); 10 Aug 2012 01:01:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Aug 2012 01:01:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=packrat@nznet.gen.nz; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=packrat@nznet.gen.nz; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nznet.gen.nz from 210.54.141.249 cause and error) X-PHP-List-Original-Sender: packrat@nznet.gen.nz X-Host-Fingerprint: 210.54.141.249 mta06.xtra.co.nz Received: from [210.54.141.249] ([210.54.141.249:27586] helo=mta03.xtra.co.nz) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E6/F4-00812-77D54205 for ; Thu, 09 Aug 2012 21:01:44 -0400 Received: from [127.0.0.1] (really [125.237.149.70]) by mta03.xtra.co.nz with ESMTP id <20120810010139.BCTI22346.mta03.xtra.co.nz@[127.0.0.1]> for ; Fri, 10 Aug 2012 13:01:39 +1200 Message-ID: <50245D70.706@nznet.gen.nz> Date: Fri, 10 Aug 2012 13:01:36 +1200 User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: internals Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Generators in PHP From: packrat@nznet.gen.nz ("Morgan L. Owens") hakre wrote: >> Also, currently yield looks very similar to return and I think this >> is a nice thing as it is similar semantically. yield($foo) would >> give it different semantics, imho. > > I love this point a lot. Return is very common and yield is some > kind of return. > I agree also: yield behaves far more like a return statement than a function call. (In a sense, a yield is a return that doesn't discard the current function's execution state.) Which (as it happens) reminds me of the difference between return $foo; and return ($foo);