Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92566 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94993 invoked from network); 20 Apr 2016 19:33:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Apr 2016 19:33:01 -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 212.232.28.124 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 212.232.28.124 mx203.easyname.com Received: from [212.232.28.124] ([212.232.28.124:51319] helo=mx203.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 04/04-14036-B69D7175 for ; Wed, 20 Apr 2016 15:33:00 -0400 Received: from cable-81-173-133-226.netcologne.de ([81.173.133.226] 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 1asxrs-0000Y1-Ur; Wed, 20 Apr 2016 19:32:57 +0000 Reply-To: internals@lists.php.net References: <570E99AC.3090804@fleshgrinder.com> <570EA5EB.8090501@fleshgrinder.com> <570EAB0D.6080706@gmail.com> <570EB67E.8010908@garfieldtech.com> <5B147E88-CC0A-4CBC-A49D-C7FE3BF557C0@zend.com> <6F.C3.12455.94C5F075@pb1.pair.com> <20160414094440.GF19347@phcomp.co.uk> <570FD94F.90703@fleshgrinder.com> <570FE8A9.4020809@gmail.com> <20.53.29891.17401175@pb1.pair.com> <57110BCD.5030009@garfieldtech.com> <571124C2.9040606@gmx.de> <57112F31.8070209@garfieldtech.com> <57166BC9.8020602@fleshgrinder.com> <57168EF6.3050004@fleshgrinder.com> To: Zeev Suraski , "internals@lists.php.net" Message-ID: <5717D957.5080107@fleshgrinder.com> Date: Wed, 20 Apr 2016 21:32:39 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Jl4HoujmkiIweVtNV3FBIeL76CSEaRv9k" X-ACL-Warn: X-DNSBL-BARRACUDACENTRAL Subject: Re: [PHP-DEV] Re: Improving PHP's type system From: php@fleshgrinder.com (Fleshgrinder) --Jl4HoujmkiIweVtNV3FBIeL76CSEaRv9k Content-Type: multipart/mixed; boundary="K4IstbLELHrd02U5nVhQgqsq9IWIXaO50" From: Fleshgrinder Reply-To: internals@lists.php.net To: Zeev Suraski , "internals@lists.php.net" Message-ID: <5717D957.5080107@fleshgrinder.com> Subject: Re: [PHP-DEV] Re: Improving PHP's type system References: <570E99AC.3090804@fleshgrinder.com> <570EA5EB.8090501@fleshgrinder.com> <570EAB0D.6080706@gmail.com> <570EB67E.8010908@garfieldtech.com> <5B147E88-CC0A-4CBC-A49D-C7FE3BF557C0@zend.com> <6F.C3.12455.94C5F075@pb1.pair.com> <20160414094440.GF19347@phcomp.co.uk> <570FD94F.90703@fleshgrinder.com> <570FE8A9.4020809@gmail.com> <20.53.29891.17401175@pb1.pair.com> <57110BCD.5030009@garfieldtech.com> <571124C2.9040606@gmx.de> <57112F31.8070209@garfieldtech.com> <57166BC9.8020602@fleshgrinder.com> <57168EF6.3050004@fleshgrinder.com> In-Reply-To: --K4IstbLELHrd02U5nVhQgqsq9IWIXaO50 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 4/19/2016 10:19 PM, Zeev Suraski wrote: > I can only repeat - primitive types can and should get dedicated soluti= ons. There's really no need for allowing over creativity with userland-c= ustomized scalar types. If we think that a certain scalar definition mak= es a lot of sense, we can add it at the language level. There's no need = to complicate the language, add syntax which makes no sense for objects a= nd isn't really needed for scalars either. >=20 We can for many: type number :=3D int|float type object :=3D type scalar :=3D bool|int|float|string =2E.. However, what about: type ? :=3D array|Traversable type ? :=3D int|string type ? :=3D float|string type ? :=3D bool|null =2E.. I actually argue that we do not even want to define them on a language level (with the exception of array|Traversable) because these combinations are too usecase specific. >> interface HouseCat { >> function drink(); >> } >> >> interface Dog { >> function eat(); >> } >> >> -interface Lion { >> +interface Lion extends HouseCat, Dog{ >> function drink(); >> function eat(); >> } >=20 > Pardon me saying this but it doesn't appear as if you've read what I wr= ote. Please take a look at the 'diff' I made in the definition of your L= ion class, because without it, your sample and mine have little to do wit= h each other. >=20 > With that change in place, please reevaluate whether what you said is r= elevant: >=20 I guess I just jumped over that fact and misinterpreted it because what you are proposing is a magic intersection type limited to interfaces. While I cannot think of a situation where this creates problems from a technical point of view (it is duck typing after all) I find it highly, highly unusual and way too magic as well as even confusing. I think there are two ways: - No union/intersection at all! + Union and intersection! Going somewhere in between destroys generics, bounded quantification, and F-bounded quantification in the future or at least makes it harder to implement cleanly. You need to consider that this RFC might be voted negative but it might come back in PHP 8 or PHP 9 where the landscape has changed so vastly that it might become a yes. Let's not introduce half backed features that nobody ever implemented and found useful in any context or we end up with more weirdness that we already have a some points. --=20 Richard "Fleshgrinder" Fussenegger --K4IstbLELHrd02U5nVhQgqsq9IWIXaO50-- --Jl4HoujmkiIweVtNV3FBIeL76CSEaRv9k 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 iQIcBAEBCAAGBQJXF9lfAAoJEOKkKcqFPVVrPV4P/1HmGsop04AvdiqvHO3Af9Ao 6ojlw71uKZ9y51S5yk+t9BEvNY6whxf/kL5temzmn12PmVEgkkpF+wT26nxFBQ8q Y7RS5BHYoIPUEZTjA2mDGbe6NkTFdpLpfsH93u31/IujECqgJKi9Bh026UleJnXI mYdq7ToBpl66GMn/u/vMI9ZzyJsYc+oBTaV13B+ayZTy/c6kH/GOFXRSmZtPjMNK Clmn5avzgQEPh066jOaeCjRUXiN+EqXDryhTJIYootKrQ86aPeZSc50L2qneJR2W 8yfzST5ND+SGpD5znbLvEJyy+riSmUIvlndP+dVmp/P0ZuU2NDjOmPHUltPaJdbG sdj1gA4051gWSTraSxW1kqq9JhZY+uLhs3S4iIrmvdqBD2Jef85i9GITvzk2wRtS bVQr1HI6Eh3IcZ5yDvTnVDUKzoSFXYMjHUJnAvQ9PIxUIr6l/szpqAwba4mMWPq8 P5KsJ7tOmMnGGhgm9Fz05g3QXfgMCoGo8KD4WUzy1GHlAIWa1AgyrD9TvVbkJ6uJ sXiBVmEN1hhO6/odGfA6pRgEB2Jqu7lTmECsY3Ruj5QeFzAkiIysAbp6K2sdzytw rtBLH686Wx73FbSXCB0TVkEkfWaBfpm/iR04rQA5iPaVMKzGlTGeFgdtIT9T8ukt Mj56QetYlilXvEdK7S/Y =kaF3 -----END PGP SIGNATURE----- --Jl4HoujmkiIweVtNV3FBIeL76CSEaRv9k--