Sent from my iPad On Dec 22, 2011, at 5:51 PM, "Ángel González" <keis...@gmail.com> wrote:
> Your examples only show class methods with visibility qualifyiers, and > looking at the changes to zend_language_parser.y > it seems as if would only be available for methods. Wouldn't return > hints be available for plain functions? Right now, it's only available for methods. Personally, I'm not a fan of return types for functions. Adding this for functions in its form today will also introduce shift/reduce issues. > > In functional programming, it is common to return nullable types: > returns an instance of class Foo or null, an array or false, etc. > > This is supported in normal arguments with the "= null" hint, and I > think there should be something equivalent for return types. > Does the proposed implementation allow null everywhere? (there's an > example of returning null from a return hint of array) > That seems wrong to me. Unless there's a way to make it strict (eg. > array! for only arrays). Most modern languages allow returning null in any case. This is a hail Mary in the event something happens, but throwing an exception is inappropriate. I see no reason to diverge from that. > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php