Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99182 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29203 invoked from network); 25 May 2017 16:48:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 May 2017 16:48:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 77.244.243.83 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 77.244.243.83 mx102.easyname.com Received: from [77.244.243.83] ([77.244.243.83:47338] helo=mx102.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8F/CA-10292-DBA07295 for ; Thu, 25 May 2017 12:47:59 -0400 Received: from cable-81-173-132-37.netcologne.de ([81.173.132.37] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1dDvvU-0002c8-Ux; Thu, 25 May 2017 16:47:54 +0000 References: <269187f4-5924-a7cc-9163-40134546451f@fleshgrinder.com> To: php-internals , Andrey Andreev Message-ID: <6359dbf4-2c55-cedf-a863-691b0f7c747d@fleshgrinder.com> Date: Thu, 25 May 2017 18:47:51 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="vh0Xko4LLoGVhupmXSOPqBv8f7EQHD2gc" X-DNSBL-PBLSPAMHAUS: YES Subject: Re: [PHP-DEV] Parameter type widening RFC From: php@fleshgrinder.com (Fleshgrinder) --vh0Xko4LLoGVhupmXSOPqBv8f7EQHD2gc Content-Type: multipart/mixed; boundary="8A2IrIiWB8kXIBcSL16lIpHoDoxjWGNkC"; protected-headers="v1" From: Fleshgrinder To: php-internals , Andrey Andreev Message-ID: <6359dbf4-2c55-cedf-a863-691b0f7c747d@fleshgrinder.com> Subject: Re: [PHP-DEV] Parameter type widening RFC References: <269187f4-5924-a7cc-9163-40134546451f@fleshgrinder.com> In-Reply-To: --8A2IrIiWB8kXIBcSL16lIpHoDoxjWGNkC Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 5/25/2017 6:38 PM, Andrey Andreev wrote: > Sorry, but by "source" I didn't mean somebody state it here. :) >=20 > When I said I don't claim to fully understand LSP, I didn't mean "tell > me what it is" - I'm familiar with it. What I don't understand is how > do we get from this: >=20 >> Wikipedia: >> >> an object of type T may be substituted with any object of a subtype S >=20 >=20 > To this: >=20 >> A single type may be substituted by any other type >=20 >=20 > Cheers, > Andrey. >=20 Hey Andrey! Do not mix the LSP with type variance on arguments or return types. The LSP is targeting subtyping directly. The quoted sentence refers to the fact that S is not allowed to behave differently than T. I think you get a better understanding if you read the "A typical violation" part of the Wikipedia article. The problem we are dealing with is variance of method arguments (and return values). The corresponding Wikipedia article is here: https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_sci= ence) Specifically contravariant arguments: https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_sci= ence)#Contravariant_method_argument_type Hope this helps to clarify things. :) --=20 Richard "Fleshgrinder" Fussenegger --8A2IrIiWB8kXIBcSL16lIpHoDoxjWGNkC-- --vh0Xko4LLoGVhupmXSOPqBv8f7EQHD2gc Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJZJwq3AAoJEOKkKcqFPVVr3B8P/j1Ex+eTdmgZHlvy09U8vwWs 4uQl9U0HPHFwIVIu9V59m8muHFj+zltIhYIn/RS763tEu8xrnS32AdX/I8BQjs8F fETF5o1i100ei6xP3pQQd5tepcYlykQ4zqKo5fAKonmloCeiKPuRB91lJO6jm2kv RgfAHUP6YPSwf+9zecrgK5Sgrs0t1+gX8A+lCvJ44CMUiXLxsUGhuW2SAE/kYcIX 12NgG1EWPpyGvPFLo2eUcZVe0IKlK7xaSLxzW6sX/l3UahGLHaup1eA0TXv0rRgq 8VdYTKdYi4kW5rOEEBoFdYvyO+bq/BjSMeblaD5jHUk8KexD/4dk+KyiTR9jSMBq QWg4RYcv5j53AboJcQsbD60u1IrpyUOzl4wzcth6Y0r9rJHEDT8NYx8ThhaoxDxn PO293kcgaIbPaXvXdyJlVv7IaYpdUr7tu+ZqzHVOHcwaqfDrVOMbuM/HtZ7dZFwu U1kVck+xc/YzzzY4PoMQiR/2S/n5F7ijFednoMfS098U3qm1mTDIeNkb1XZp5Lss W7bRmOHNQUzorMaqC/jqzB4tngNqYJ/jQvY1HOn1ZFQl65SmUvkcjzhcxQR/4TKi WN3V8Z6LLqaqo327BXyPsrpcfMkOxZYPe9JbTBVvXuaEeiiasuIMFBaJEb8NBNVw qbhb2keihP2A2mZD4+cV =xYo1 -----END PGP SIGNATURE----- --vh0Xko4LLoGVhupmXSOPqBv8f7EQHD2gc--