Re: Types on the right or on the left

From: Date: Wed, 05 Nov 2014 01:05:37 +0000
Subject: Re: Types on the right or on the left
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-78694@lists.php.net to get a copy of this message
Hi! > Except static function() and static function > foo() already have > meaning, and if we allowed static return types (very possible) that > would be ambiguous. This syntax is a no-go. If it is possible, why it's not the part of the RFC? Probably because there's not much place where it would make sense. So, the only objections so far have been: 1. Foo function bar() somehow is not greppable 2. It is not clear that Foo function bar() means function 3. We could somehow in some undefined time in the future allow static there, even though we're designing it right now and we actually *do not* allow it and see no reason to allow it. 4. People would think in "Foo function bar()" "Foo" is somehow type of the whole function, not its return value, despite PHP having no concept of function type at all and no means to express such type and no need to do so. 5. Using ":" is more consistent, because it's "output type", so it is not the same as type on parameters. 6. It's inconsistent with "normal function declarations". 7. We discussed it on Stack Overflow, and decided it's not inconsistent. 8. "It is weird". 9. "It is a no go". Does this really sound convincing argument to anybody? Because it definitely doesn't to me. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/

« previous php.internals (#78694) next »