On 08/19/2012 07:07 PM, Stas Malyshev wrote: > 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. > > Also, I think that people that complain about having to scan through > huge functions to see if they're generators or not, forget one thing: > documentation. Yes, there is a way to make the purpose of the function > understandable to a human without having him to do computer's work. > That's documentation. Undocumented code is broken code. Broken code is > not a good example when we're talking about right design.
I would still like to understand what this generator keyword would actually do. I don't see how it would work. Would a function marked generator somehow not be allowed to return normally or to finish and not return anything? How could this be enforced? I am completely against any keyword that is essentially documentation-only. -Rasmus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php