Re: [RFC][Discussion] Return Type Variance Checking
| From: | Dmitry Stogov | Date: | Fri, 28 Nov 2014 12:27:53 +0000 |
| Subject: | Re: [RFC][Discussion] Return Type Variance Checking | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-79272@lists.php.net to get a copy of this message | ||
I didn't get what you mean.
parameters are invariant, "invariance, which is safe for both" and " it
shouldn't match parameters" are contradictory.
Thanks. Dmitry.
On Fri, Nov 28, 2014 at 1:57 PM, Andrea Faulds <ajf@ajf.me> wrote:
>
> > On 28 Nov 2014, at 09:31, Dmitry Stogov <dmitry@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.
>
> --
> Andrea Faulds
> http://ajf.me/