Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99158 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45604 invoked from network); 24 May 2017 18:39:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 May 2017 18:39:24 -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.164 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 212.232.25.164 mx208.easyname.com Received: from [212.232.25.164] ([212.232.25.164:48455] helo=mx208.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 22/DF-10292-A53D5295 for ; Wed, 24 May 2017 14:39:22 -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 1dDbBl-0001xu-6V; Wed, 24 May 2017 18:39:19 +0000 References: To: php-internals , Marco Pivetta Message-ID: Date: Wed, 24 May 2017 20:39:07 +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="BiNx6jSXn8rJ1MjoB6DNEHkMtKLFjwc6o" X-DNSBL-PBLSPAMHAUS: YES Subject: Re: [PHP-DEV] [RFC] [Discussion] UUID From: php@fleshgrinder.com (Fleshgrinder) --BiNx6jSXn8rJ1MjoB6DNEHkMtKLFjwc6o Content-Type: multipart/mixed; boundary="T29O6xdxib0lnqREiWjOBjKo1u7CPQwkB"; protected-headers="v1" From: Fleshgrinder To: php-internals , Marco Pivetta Message-ID: Subject: Re: [PHP-DEV] [RFC] [Discussion] UUID References: In-Reply-To: --T29O6xdxib0lnqREiWjOBjKo1u7CPQwkB Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 5/24/2017 8:09 PM, Marco Pivetta wrote: > For once, I must say that I disagree with having an OOP API defined in = core. > This can exist in userland, so it probably should. Internal classes, th= eir > reflection, behavior, inheritance model, etc are full of quirks. > There's nothing wrong in returning a string, then having a userland lib= > make it into a UUID value object: it actually is better for everyone's > sanity. > It would (probably) be better to stop at the function that actually > generates the identifier, then having the boxed value defined in userla= nd > anyway. Yes, we lose the type hinting, but damn are internal classes ug= ly. > If you must keep the object style, make it `final`, so at least we won'= t > have people extending this thing for no good reason at all :-P >=20 > Marco Pivetta >=20 The problem with procedural APIs is, especially with the way the PECL UUID is implemented, that you are constantly converting back and forth. While OO allows you to encapsulate your things. There is actually only a single thing that is not (yet) possible with Reflection on internal methods: getting the default values of a parameter. I wrote Reflection tests for every single thing, to ensure that it works as good as possible. Have a look at the `definition.phpt` test cases: https://github.com/Fleshgrinder/php-src/tree/rfc/uuid/ext/standard/tests/= uuid Here is one where I had do comment the default value thingy: https://github.com/Fleshgrinder/php-src/blob/rfc/uuid/ext/standard/tests/= uuid/UUIDParseException/__construct/definition-005.phpt#L15 And yes, everything is `final` to ensure that nobody can do anything with the classes. This applies to the `UUID` and the `UUIDParseException`= =2E Furthermore, I carefully crafted everything to be as close to userland as possible. No magic, none at all. I use default PHP built-in stuff for everything. Even the parameter parsing is 1:1 as it would be if you would define the very same class in PHP. I will extend my signature with "No Magic!" now. ;) --=20 Richard "Fleshgrinder" Fussenegger --T29O6xdxib0lnqREiWjOBjKo1u7CPQwkB-- --BiNx6jSXn8rJ1MjoB6DNEHkMtKLFjwc6o 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 iQIcBAEBCAAGBQJZJdNLAAoJEOKkKcqFPVVrh44QAKZ+yJYSqx8lchlL4e+40rvI 9nXL057c0s2ThOL7sy0l4W9WAo+fFY1jMDsu5kv7xuVZuwL8SoQjBjqe04YnicBE L/c9vcHu3WF9rNfciQAwl9iRqZLd8tEl5a0vtFbU/9R0jsamX0msNdyxOY86CWVC Glo+5O8UoCVvBrXwGRZ438xVcw1mpzzbXItU5nEd15VEk9WLvj6tvSatHy2XbnF+ /tKxvcE7OfehzR9UwPktLiWPpkunoIKn3bIKUlGHHpghaKdoNZ6Kw9UbpmgKNGYt SfuiANBq69wsU3qFudVuJMf9B2sgWNRYGfbMjN2glLdD4JzVRjaXgDmUQPKqcI/H 7a+gAeEgB/bA0o4QjYw6HbimuxBr7dRpOkl+TYz9BCBiMXHTrgQVb7crOyqzxCnv sr5MbnwcQbAXnzO84vEZcIiivXmE2lLJwzext/leBAsD3pnbm43LQRmQcyQu0IHd pL2UlVWx8yTeoNwVMxJ2XmTISDTcdFoQ5NjLrJ6TFxCqDgO0yDsyVESGOmb7pqJD pCWasNhe4pQz76bMO5Seq3TXdNi+W7ViAdoMCrHI2zfdgE1ZC9gf90XRd92zQ2Qh b5Rqzi7G9Gp9mUcgRyBLlvbuEIH3jrTwUyDbEn0Tyz6Q7biE0/mJTFQ9RsD+tEIh PKfOXt0FC19dYX5MPgLa =PCaA -----END PGP SIGNATURE----- --BiNx6jSXn8rJ1MjoB6DNEHkMtKLFjwc6o--