Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61713 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69737 invoked from network); 24 Jul 2012 18:05:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jul 2012 18:05:08 -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 Linux 2.6 Received: from [64.22.89.134] ([64.22.89.134:47788] helo=oxmail.registrar-servers.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E8/A0-01267-2D3EE005 for ; Tue, 24 Jul 2012 14:05:07 -0400 Received: from [192.168.0.200] (5ad32874.bb.sky.com [90.211.40.116]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by oxmail.registrar-servers.com (Postfix) with ESMTPSA id DC5443E8001 for ; Tue, 24 Jul 2012 14:05:03 -0400 (EDT) Message-ID: <500EE3B9.8010902@ajf.me> Date: Tue, 24 Jul 2012 19:04:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: internals@lists.php.net References: <500EDCC7.1020402@ajf.me> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: Generators in PHP From: ajf@ajf.me (Andrew Faulds) On 24/07/12 18:56, Alex Aulbach wrote: > 2012/7/24 Andrew Faulds : >> Much easier to make an iterator with a function than as a class. > 2012/7/24 Yahav Gindi Bar : >> I agree, implementing a class only for iterator may be pain sometimes, and functions is much better - especially when 5.3 got the anonymous functions, so we can even use the generators for iterator functions in class methods which can be great. > Ok, why not call it "iterator" or "generator" or "huffpuff" instead of > "function"? It's just the naming, which disturbs me, because a > function is something which is, when called once finished once. I > don't like mathematics, but that is one of the definition of a > function: > > http://en.wikipedia.org/wiki/Function_%28mathematics%29 > "each input is related to exactly one output" > > Couldn't be so complicated to introduce a new name for that, or? > You'll love LISP, I'm sure, or maybe Python's functional subset. But PHP functions usually have side-effects, they aren't strict mathematical functions. So complaining about this is rather pointless. -- Andrew Faulds http://ajf.me/