Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61714 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71014 invoked from network); 24 Jul 2012 18:06:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jul 2012 18:06:47 -0000 Authentication-Results: pb1.pair.com smtp.mail=g.b.yahav@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=g.b.yahav@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.54 as permitted sender) X-PHP-List-Original-Sender: g.b.yahav@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-wg0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:48292] helo=mail-wg0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C7/F0-01267-534EE005 for ; Tue, 24 Jul 2012 14:06:47 -0400 Received: by wgx1 with SMTP id 1so5625597wgx.11 for ; Tue, 24 Jul 2012 11:06:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :message-id:references:to:x-mailer; bh=iVPnel0O2NyDeppuUJQpx8HSAC2eiyZUsRr9UKX+6qo=; b=H3GV5fRESy3djliMkecouIbFy8qWu6VgNgrZXYQOCLiGQgz2Rf2khdSdFFIXDGO/Gr QOaRpkBKHIg9yId5jFn+SsVr+vBXaeOLu0GgIyw/s7B+AMjpbJWf3VPargc3KeO8HlUx u8nR1fhimZGl25DbYEvvjW1VEBdhP4flrymLitFcLbjaLH4DD2oZ31NTZN1AV+iGPJxO jLlRFlWnCKfbpzG9lV4vq2OxOrDeoDSJ3iO9OamdPgC8LV4FCavsNdDvQ2NxUD5I50Uq iqOPLcBbzLcX2jJYJoHfjePzoop1oM3hcb3gybqQ0kjuoiCt8klwQfLWHqt+EQ2PrCvb a2Ag== Received: by 10.216.27.21 with SMTP id d21mr9884876wea.152.1343153203144; Tue, 24 Jul 2012 11:06:43 -0700 (PDT) Received: from [10.0.0.3] ([109.64.148.5]) by mx.google.com with ESMTPS id fr4sm8418252wib.8.2012.07.24.11.06.41 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 24 Jul 2012 11:06:42 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: multipart/alternative; boundary="Apple-Mail=_96F8F763-FAB4-4400-B8AB-B780386A03F8" In-Reply-To: Date: Tue, 24 Jul 2012 21:06:39 +0300 Cc: internals@lists.php.net Message-ID: <224BD95C-B652-42CA-B397-846E7544680B@gmail.com> References: <500EDCC7.1020402@ajf.me> To: Alex Aulbach X-Mailer: Apple Mail (2.1278) Subject: Re: [PHP-DEV] Re: Generators in PHP From: g.b.yahav@gmail.com (Yahav Gindi Bar) --Apple-Mail=_96F8F763-FAB4-4400-B8AB-B780386A03F8 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 You could introduce new keyword for generator... even call it = "generator" but why (its kind of "design" issue...)? if the syntax that = one should use in order to implement the generator is just like a = function, but using yield keyword in order to return the items to store? As long as I know, most programming languages that uses generators wrap = it up in a function, so why shall we introduce new keyword that can = confuse programmers? I think using function and returning the value using yield is great... = although I'm open to any new nicely-written generator syntax. On 24 =D7=91=D7=99=D7=95=D7=9C 2012, at 20:56, Alex Aulbach wrote: > 2012/7/24 Andrew Faulds : >> Much easier to make an iterator with a function than as a class. >=20 > 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. >=20 > 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: >=20 > http://en.wikipedia.org/wiki/Function_%28mathematics%29 > "each input is related to exactly one output" >=20 > Couldn't be so complicated to introduce a new name for that, or? >=20 > --=20 > Alex Aulbach --Apple-Mail=_96F8F763-FAB4-4400-B8AB-B780386A03F8--