RE: [PHP-DEV] [RFC] Generators

From: Date: Mon, 20 Aug 2012 00:08:47 +0000
Subject: RE: [PHP-DEV] [RFC] Generators
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-62273@lists.php.net to get a copy of this message
> -----Original Message----- > From: Stas Malyshev [mailto:smalyshev@sugarcrm.com] > Sent: 20 August 2012 00:08 > To: Derick Rethans > Cc: Nikita Popov; PHP internals > Subject: Re: [PHP-DEV] [RFC] Generators > > Hi! > > > 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 have a point here, but "public static final generator > function foo()" sounds a bit long-winded to me... Also, we'd > have then to decide which function can be marked generator > and which can't (e.g., interface probably can't, abstract > probably can't, anonymous probably can, etc.) which adds more > complexity. That'd be return type hinting would it not? Given that generator functions currently return an instance of class Generator. Also anonymous generators would be quite strange $f = Generator function() { yield 'a'; }; Jared

« previous php.internals (#62273) next »