Re: [RFC][Discussion] Return Type Variance Checking
| From: | Rowan Collins | Date: | Wed, 26 Nov 2014 22:51:16 +0000 |
| Subject: | Re: [RFC][Discussion] Return Type Variance Checking | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-79205@lists.php.net to get a copy of this message | ||
On 26 November 2014 10:21:12 GMT, Lazare Inepologlou <linepogl@gmail.com> wrote:
>http://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)#Covariant_method_return_type
Can I just recommend that everyone interested in this discussion read that whole article (at least
until it gets into the guts of generics, which gets more and more complex). It explains the concepts
extremely clearly, both in their theoretical basis and their practical implementation and
limitations.
I often worry that PHP is designed too much around examples and use cases, rather than more formal
theoretical foundations, so I'm pleased this conversation has led me to learn those concepts.
Obviously, that article points out, there is sometimes value in ignoring the theoretically pure in
favour of the practical, but the adage applies that you should first understand the rules before
deciding to break them.
Regards,
--
Rowan Collins
[IMSoP]