Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62100 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99880 invoked from network); 9 Aug 2012 10:11:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Aug 2012 10:11:47 -0000 Authentication-Results: pb1.pair.com smtp.mail=M.Ford@leedsmet.ac.uk; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=M.Ford@leedsmet.ac.uk; sender-id=pass Received-SPF: pass (pb1.pair.com: domain leedsmet.ac.uk designates 207.126.144.149 as permitted sender) X-PHP-List-Original-Sender: M.Ford@leedsmet.ac.uk X-Host-Fingerprint: 207.126.144.149 eu1sys200aog120.obsmtp.com Linux 2.5 (sometimes 2.4) (4) Received: from [207.126.144.149] ([207.126.144.149:39264] helo=eu1sys200aog120.obsmtp.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 35/26-00812-FDC83205 for ; Thu, 09 Aug 2012 06:11:46 -0400 Received: from mrelay-c.lmu.ac.uk ([160.9.192.20]) by eu1sys200aob120.postini.com ([207.126.147.11]) with SMTP ID DSNKUCOM3Exy3TRK0FyeJt0fjkBzpqoN0qNP@postini.com; Thu, 09 Aug 2012 10:11:45 UTC Received: from exc-hcas02.leedsmet.ac.uk ([160.9.47.12]) by mrelay-c.lmu.ac.uk with esmtp (Exim 4.60) (envelope-from ) id 1SzPiN-0002b3-0W for internals@lists.php.net; Thu, 09 Aug 2012 11:11:39 +0100 Received: from EXC-MBX01.leedsmet.ac.uk ([fe80::6da4:759c:4d76:ef0e]) by EXC-HCAS02.leedsmet.ac.uk ([fe80::84dc:a514:db71:771a%10]) with mapi id 14.02.0283.003; Thu, 9 Aug 2012 11:11:39 +0100 To: "internals@lists.php.net" Thread-Topic: [PHP-DEV] Re: Generators in PHP Thread-Index: AQHNZrjWZqrmPY9K90qMexoqwCVMYZc2FowAgABafACAAjXXgIAAADyAgAAB8wCAAAQeAIAAAjaAgAAHrACAAABdAIAAjmWAgABN9wCAABBqgIAAQ8iAgAAZJYCAABdpAIAAAQyAgAAB5ICAAACzgIAAEg4AgAACX4CAFyUtQA== Date: Thu, 9 Aug 2012 10:11:37 +0000 Message-ID: <3158105795AAC1408619EC8BA03384A9223C6296@EXC-MBX01.leedsmet.ac.uk> References: <500EDCC7.1020402@ajf.me> <500EE3B9.8010902@ajf.me> <500EEA76.1030407@ajf.me> <5010138D.5050804@ajf.me> <501015B9.6050704@ajf.me> <501026DB.6030507@ajf.me> In-Reply-To: <501026DB.6030507@ajf.me> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.8.18.154] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: RE: [PHP-DEV] Re: Generators in PHP From: M.Ford@leedsmet.ac.uk ("Ford, Mike") > -----Original Message----- > From: Andrew Faulds [mailto:ajf@ajf.me] > Sent: 25 July 2012 18:03 [...] > Fact: Adding a new name for a special kind of function as a syntax > construct is going to cost (possibly unnecessary) time and energy, > because now you have functions, and weird things that look almost > like=09 > functions but aren't and can only be used to make generators. That looks to me like a perfect argument *in favour* of the "generator" keyword! I'm a very literal kind of person, and I would absolutely want "weird things that look almost like functions but [...] can only be used to make generators" to be clearly labelled as such without having to hunt through the body of the not-quite- function. The signposting needn't even be as in-your-face as a generator keyword (either instead of or in addition to function): I could get behind a variation such as: function f($x, $y) yields { ... yield $z; ... } Or even (stretching a bit to re-use an existing keyword!): function f($x, $y) return { ... yield $z; ... } Although I like the concept of generators, I would be -1 for any implementation that doesn't differentiate them in some way from regular functions. Cheers! Mike --=20 Mike Ford, Electronic Information Developer, Libraries and Learning Innovation,=20=20 Portland PD507, City Campus, Leeds Metropolitan University, Portland Way, LEEDS,=A0 LS1 3HE,=A0 United Kingdom=20 E: m.ford@leedsmet.ac.uk T: +44 113 812 4730 To view the terms under which this email is distributed, please go to http:= //disclaimer.leedsmet.ac.uk/email.htm