Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99194 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89792 invoked from network); 26 May 2017 08:34:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 May 2017 08:34:54 -0000 Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; 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:46679] helo=mx102.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4A/91-10292-BA8E7295 for ; Fri, 26 May 2017 04:34:52 -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 1dEAhq-0005Oz-97; Fri, 26 May 2017 08:34:48 +0000 References: To: php-internals , Marco Pivetta , Kalle Sommer Nielsen Cc: Larry Garfield Message-ID: <83c4075f-b694-4e83-fc09-4210e0091216@fleshgrinder.com> Date: Fri, 26 May 2017 10:34:22 +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="kFNU13to9nQmjUM0sFVRnVLlCtpxd0ifm" X-DNSBL-PBLSPAMHAUS: YES Subject: Re: [PHP-DEV] [RFC] [Discussion] UUID From: php@fleshgrinder.com (Fleshgrinder) --kFNU13to9nQmjUM0sFVRnVLlCtpxd0ifm Content-Type: multipart/mixed; boundary="ClXgLjrhjSd3olFK99GswgSC9MDJoXXIf"; protected-headers="v1" From: Fleshgrinder To: php-internals , Marco Pivetta , Kalle Sommer Nielsen Cc: Larry Garfield Message-ID: <83c4075f-b694-4e83-fc09-4210e0091216@fleshgrinder.com> Subject: Re: [PHP-DEV] [RFC] [Discussion] UUID References: In-Reply-To: --ClXgLjrhjSd3olFK99GswgSC9MDJoXXIf Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 5/26/2017 1:08 AM, Marco Pivetta wrote: > Saw the discussion on github, and I wish that the argument parsing just= > behaved like a *NORMAL* PHP method. >=20 > The following is perfectly valid: >=20 > $crapTonOfUuids =3D array_map([UUID::class, 'v4'], range(0, 1000)); >=20 > This would raise a lot of warnings if the API didn't behave like it doe= s in > userland (warning on too many arguments). > A point was raised about BC compliance when adding parameters (future > scope), well here's the news: stop adding arguments to existing functio= ns, > make some damn new functions/methods/classes (to whoever still thinks t= hat > adding arguments is a valid decision). >=20 Well, I agree on the adding arguments part. I actually complained a lot about this in the past. https://github.com/php/php-src/commit/49aed4fd75e9560444f63593b67fc4ed18e= 233c9#commitcomment-22277780 I added them because Kalle and Nikita really want to have them. Changing the return types to be nullable is a complete no-go for me. I am sure Larry would agree here with me. The approach I've taken right now would allow one to write: $crapTonOfUuids =3D @array_map([UUID::class, 'v4'], range(0, 1000)); As it would emit a warning, but still generate them. Well, unless you have strict-types mode activated, in that case you would receive the ArgumentCountError. I really don't know what the proper solution for this problem is. I would just leave it out, as I did initially. Nothing bad can happen from passing too many arguments; not enough should directly lead to an ArgumentCountError, that's for sure. On 5/26/2017 1:08 AM, Marco Pivetta wrote: > The UUID type and specification is simple and clear. > Also, a UUID is a data type with no real behavior. > The only possible and valid scenario for subclassing would be to add > semantic meaning because the developer invented a new type of UUID: tha= t's > to be excluded, as such an implementation (if relevant and secure) woul= d > land in core anyway in future PHP releases. > Subclassing to alter behavior (generation/serialisation, if you want to= > call them "behavior") would be a mistake that could even lead to securi= ty > issues, and it should be avoided. > This class should be final, so keep it final, IMO. >=20 > Marco Pivetta >=20 +1 --=20 Richard "Fleshgrinder" Fussenegger --ClXgLjrhjSd3olFK99GswgSC9MDJoXXIf-- --kFNU13to9nQmjUM0sFVRnVLlCtpxd0ifm 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 iQIcBAEBCAAGBQJZJ+iiAAoJEOKkKcqFPVVrdKAP/35QYtPayHxy8p7UGyVGI+J1 8NY+P7iMKkVPH/V+S1X9A6IwAt1pLLQUMbVpkinRiWuFu5scC2WhmT33hd0PO/Np LduxnTf6qk/KQoCHTCOdp5CgzmBWC2Z+NNDRemqB/upghzWaPEAoAto3dWW07nWe 3GQaV7RC7P8vFGAbij5EjkksiIbWok1mQUrr+FicvbMAOnb0vF3hYMSHb9TXtpYp tWzrjluA0WjypzF4QdCIq6enkQigwHO8IZMVVh38q6lg2AwLT3JuemzZ6jOBQGkV /PNjlIXNOfgxcIqDkuOQsnzr9cBV2jxDqTTbtv6Qmy20IMoCSIJe/FC4TvRq5qIo 24cWPzOLQfqhaZlNS7oVz/+b4WE1QZAoZEcHSvLRbIbKQWOs6QNFtCF5gGktO5hX PdYqA+xQcmsr9bXfCH4BLCfvPIY/mLXACkGKx6nflUutOpXBH7txJY2dlYwNAAOz 1Btz2iV6m4q7bZD9R43ogH9iF8MyjtTUYJxVxAhPZYoJk7eK+68rSuCtV4fDgiVd /LWmeSJ3QksuF+RgzQ+3hGxE6DC9nw1tNKWt0wBgpoQDK9kd4YOt37e1iFMREpJv NZcQl3AIZwHKgBMuIOiZ2Q/N8hsm3Y3I0zKSZ6iIz1bCnOwdpHmkHzxgGzroiZ6x OytlkVKb2XUnVVl2f5k/ =qLGW -----END PGP SIGNATURE----- --kFNU13to9nQmjUM0sFVRnVLlCtpxd0ifm--