Andrea Faulds wrote on 28/11/2014 10:57:
On 28 Nov 2014, at 09:31, Dmitry Stogov <dmi...@zend.com> wrote:
I prefer option (3) - invariant return types.
Actually, return type compatibility check should follow all the rules for
parameter type compatibility check (may be even reuse or share the code).
No, it shouldn't match parameters, that'd break type safety. What's safe for
parameters is the opposite of what's safe for return types. The exception is
invariance, which is safe for both.
I think you're both saying the same thing: current implementation of
parameter checking is invariant, proposal is to make return type
checking invariant. Thus, for now, it can share the implementation.
Later, covariant returns and/or contravariant parameters could be added,
at which point the checks would need to be split apart again.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php