Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92383 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23327 invoked from network); 17 Apr 2016 12:35:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Apr 2016 12:35:46 -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.25.166 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 212.232.25.166 mx210.easyname.com Received: from [212.232.25.166] ([212.232.25.166:47326] helo=mx201.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 57/8A-32052-F1383175 for ; Sun, 17 Apr 2016 08:35:44 -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 1arlvN-0004NW-Qs; Sun, 17 Apr 2016 12:35:38 +0000 Reply-To: internals@lists.php.net References: <57136573.7070802@fleshgrinder.com> <57137F66.3080608@lsces.co.uk> To: Lester Caine , internals@lists.php.net Message-ID: <57138312.7020003@fleshgrinder.com> Date: Sun, 17 Apr 2016 14:35:30 +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: <57137F66.3080608@lsces.co.uk> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GhSkRpRXrXOSrdXTgOqT9PnF7xsL0D6kF" X-ACL-Warn: X-DNSBL-BARRACUDACENTRAL Subject: Re: [PHP-DEV] Re: Improving PHP's type system From: php@fleshgrinder.com (Fleshgrinder) --GhSkRpRXrXOSrdXTgOqT9PnF7xsL0D6kF Content-Type: multipart/mixed; boundary="lGasF9PONtpM1G6URVxFeBBDhBcSVT8Kr" From: Fleshgrinder Reply-To: internals@lists.php.net To: Lester Caine , internals@lists.php.net Message-ID: <57138312.7020003@fleshgrinder.com> Subject: Re: [PHP-DEV] Re: Improving PHP's type system References: <57136573.7070802@fleshgrinder.com> <57137F66.3080608@lsces.co.uk> In-Reply-To: <57137F66.3080608@lsces.co.uk> --lGasF9PONtpM1G6URVxFeBBDhBcSVT8Kr Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 4/17/2016 2:19 PM, Lester Caine wrote: > On 17/04/16 11:29, Fleshgrinder wrote: >> Especially since its not needed at all. HHVM already solved most of >> these issues extremely nicely: >> >> - https://docs.hhvm.com/hack/types/type-system >> - https://docs.hhvm.com/hack/type-aliases/introduction >> - https://docs.hhvm.com/hack/shapes/introduction >> >> We want the same but do not want to copy?!? >=20 > The simple answer NO >=20 > If that is how you think it should be done, then use it. On my platform= , > 'point' is a number of floating point numbers depending on your > geometry. And shapes use those points. So that area of 'hack' is of > little use to any mapping system, and trying to shoehorn existing code > to fit is 'pointless' ... >=20 > It's the fact that many of these problems HAVE been solved without > resorting to overloading PHP with a subset that does not provide a > complete solution to the alleged problems that is the reall problem > here. Having to re-write libraries because some one else thinks the > basic rules are wrong and need fixing :( >=20 Why do you need to rewrite anything? Why do you need to use it? Especially, why do you thing that PHP was made solely for auto-mappers from some SQL to PHP? $array_point =3D array('x' =3D> 0.0, 'y' =3D> 0.0); // valid type Point =3D shape('x' =3D> float, 'y' =3D> float); $point =3D shape('x' =3D> 0.0, 'y' =3D> 0.0); // valid function distance(array|Point $p1, array|Point $p2) { // works } function distance(Point $p1, Point $p2) { // works better } var_dump($point); // array(2) { // ["x"]=3D> // float(0.0) // ["y"]=3D> // float(0.0) // } Both works and both is valid. Only the latter case ensures that it is as defined and the former allows arbitrary changes. If you need arbitrary changes go for it. It does not matter why you want to use the former (anemic domain, legacy support, no time to adopt, no muse to adopt, "everything was better in the old days", ...) as long as it solves your use case and satisfies your users. All changes that were proposed are *without any BC!* If you are only afraid that usage of your libraries declines because users demand these new features to be part of it and you do not want to implement them. Sorry, but that would be a clear sign that the features are good and should be used. --=20 Richard "Fleshgrinder" Fussenegger --lGasF9PONtpM1G6URVxFeBBDhBcSVT8Kr-- --GhSkRpRXrXOSrdXTgOqT9PnF7xsL0D6kF 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 iQIcBAEBCAAGBQJXE4MXAAoJEOKkKcqFPVVrHHwP/RXJgzq5uPQA69BCXcE6xV+F 6K32cSuogWMq5Z8E0xYVue5Uqgtfxb5c6bJ2K96tuB+eSG6OYXoJbx2YDwa7J8e8 FU95Q+nqns51ceO3lsaBgOJ7oTpqK/LxK7LSiLdi/Fe4jM1Xwqfzt8r6X4hfVjRj 5uF3Vn5sXoGnXirdqA0Vha/DY7R9IPrUZuHa7AdT/7JiGk2I9y/NgOTvqWkBMnt3 INJN+RViz/SP+nV0Vsvqfbn8Kx6cib/QdoviqRkqDj3+j9nD/keJYsdjlMs+sMa8 Xef2zIwW1GQ43540463K1yvnn5ywVbY5FioloUy56mt/XRcE29ZmwHVz43veVe1l /PXoyAwYhiks5pW40xJE+zQ752OCqR4IVBdiqZz6CFKkbJTvOHE4BEKiMbopERRl f6hvGxKr1to5Z1VgqlgCizsp9lJqRgQ8eyrlXnJpl8LGS7jtK9fO9/Qa7fS3Vrxi Je0liLOFC5/6vnVjRGkLL10PByNmX4z1dJcWx3H+VOM3plN/vY85Ik0THvWdx/E8 +kXq0vszRtJJF98CKZ0Ij6A2HFsf6ZvuWgylXNT9wt9NC2Nlm8WVOOZeVmtM0pHw iO3HeRmhY+/zerb9l7lcDJ9fJSwhS+b4gaX4pGdKca0UJffEwfFOG7nOhQ7IzoGq AVacqIonrP8klxZlu5S4 =N7oj -----END PGP SIGNATURE----- --GhSkRpRXrXOSrdXTgOqT9PnF7xsL0D6kF--