Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62310 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84813 invoked from network); 20 Aug 2012 20:19:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Aug 2012 20:19:36 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 64.22.89.134 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 64.22.89.134 oxmail.registrar-servers.com Received: from [64.22.89.134] ([64.22.89.134:36345] helo=oxmail.registrar-servers.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 20/87-07742-5DB92305 for ; Mon, 20 Aug 2012 16:19:34 -0400 Received: from [192.168.0.200] (5ad3285b.bb.sky.com [90.211.40.91]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by oxmail.registrar-servers.com (Postfix) with ESMTPSA id 26B53F0030; Mon, 20 Aug 2012 16:19:29 -0400 (EDT) Message-ID: <50329BB6.7040109@ajf.me> Date: Mon, 20 Aug 2012 21:19:02 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: Derick Rethans CC: Nikita Popov , PHP internals References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Generators From: ajf@ajf.me (Andrew Faulds) On 18/08/12 13:21, Derick Rethans wrote: > On Sat, 11 Aug 2012, Nikita Popov wrote: > >> Hi internals! >> >> I think there already was a lot of discussion on the generators, so >> it's time to move to the next step. I'd like to vote on the feature in >> two weeks, so this the "announce[ment] on internals@, by the author, >> with the intention of voting on it". >> >> https://wiki.php.net/rfc/generators >> >> If you have any further feedback, now would be a good time to raise >> it. If there is something you previously posted, but which I didn't >> yet address, please let me know. There were around 150 mails and I >> sure missed some of them. > I've some comments how that I've read the RFC: > >> Recognition of generator functions >> >> 1. Any function which contains a yield statement is automatically a >> generator function. >> >> 2. The initial implementation required that generator functions are >> marked with an asterix modifier (function*). This method has the >> advantage that generators are more explicit and also allows for >> yield-less coroutines. >> >> The automatic detection was chosen over the asterix modifier for the >> following reasons: > I am against this. This is even more magic in PHP. Is it really that > difficult to have to mark the function with a different keyword, such as > "generator": You know, this conversation feels like it's going in circles. I thought we already agreed there wouldn't be one. > >> generator function getLinesFromFile($fileName) { >> if (!$fileHandle = fopen($fileName, 'r')) { >> return; >> } >> There is an existing generator implementation in HipHop PHP, which >> uses automatic-detection. Using the asterix modifier would break >> compatibility. > This should not be a concern, sure, it's annoying for the hiphop > developers but they chose to copy and then *chance* the PHP language for > their own effect. > >> yield: Yields the value null with an auto-incrementing integer key. > What is the usecase for this? > > cheers, > Derick > -- Andrew Faulds http://ajf.me/