Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100394 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 50931 invoked from network); 5 Sep 2017 19:33:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Sep 2017 19:33:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=andreas@heigl.org; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=andreas@heigl.org; sender-id=pass Received-SPF: pass (pb1.pair.com: domain heigl.org designates 195.191.240.18 as permitted sender) X-PHP-List-Original-Sender: andreas@heigl.org X-Host-Fingerprint: 195.191.240.18 hos109.unaxus.net Received: from [195.191.240.18] ([195.191.240.18:48103] helo=hos109.unaxus.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 92/4C-04538-BEBFEA95 for ; Tue, 05 Sep 2017 15:33:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=heigl.org; s=default; h=Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe :List-Post:List-Owner:List-Archive; bh=RevPnbwMlUYvLRJRbzN0ll6nzSywbtcGJQRIiT1+XLc=; b=G89u/Mah1bbBayX/L5J81wKqpa geZBk48Tx2f0AXnoySrvHaigOcsJ8y1CPBxosCTE/kmI9n4oOzaVi0wj7sUio1lrFpzQgySYw44yO aOL/NkxyeW+41F8rcHIwTBJ65YFiM8HORH4nPdl6gx476LVNRV009zjFOljDcduhsRHlS0HQ4r+7D xjtXLo0Q7w5YKGala6rmH20KWdkUSmz0xTVDLz+TwPPdpLQg7n+1vGZn7lK45bElk33N3TaO/4GBd ++mvMD94tZcWbRMz71nTXQRECv/p6Glju6A1g6rtlLm3dVlJlpzRQtlSpqL8vAK507q1iTbhvkgfv rMGRv+ew==; Received: from heigl.gw.tgnet.de ([80.72.250.242]:51108 helo=localadmins-MacBook-Pro.local) by hos109.unaxus.net with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89) (envelope-from ) id 1dpJah-001zMM-Nx; Tue, 05 Sep 2017 21:32:55 +0200 To: internals@lists.php.net, Marco Pivetta References: <2cc94622-7f64-93af-c248-e82647e8053e@fleshgrinder.com> Openpgp: id=967CCFA50DFFEE03BB8BF5F2CA9213C75BFCE472 Message-ID: <1a596f98-cc6d-4e9f-b51a-3905fe1b0d97@heigl.org> Date: Tue, 5 Sep 2017 21:32:52 +0200 MIME-Version: 1.0 In-Reply-To: <2cc94622-7f64-93af-c248-e82647e8053e@fleshgrinder.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="AjhQVh6bVLo4VxDqFjNsIoCDVXok5iqNV" X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - hos109.unaxus.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - heigl.org X-Get-Message-Sender-Via: hos109.unaxus.net: authenticated_id: a.heigl+heigl.org/only user confirmed/virtual account not confirmed X-Authenticated-Sender: hos109.unaxus.net: a.heigl@heigl.org Subject: Re: [PHP-DEV] [VOTE] UUID From: andreas@heigl.org (Andreas Heigl) --AjhQVh6bVLo4VxDqFjNsIoCDVXok5iqNV Content-Type: multipart/mixed; boundary="aB9F09eXLVqqgrdxHmJWdBBQN2LhpxQBV"; protected-headers="v1" From: Andreas Heigl To: internals@lists.php.net, Marco Pivetta Message-ID: <1a596f98-cc6d-4e9f-b51a-3905fe1b0d97@heigl.org> Subject: Re: [PHP-DEV] [VOTE] UUID References: <2cc94622-7f64-93af-c248-e82647e8053e@fleshgrinder.com> In-Reply-To: <2cc94622-7f64-93af-c248-e82647e8053e@fleshgrinder.com> --aB9F09eXLVqqgrdxHmJWdBBQN2LhpxQBV Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hey Richard Am 05.09.17 um 19:29 schrieb Fleshgrinder: > On 9/5/2017 7:01 PM, Andreas Heigl wrote: >> Hey Richard, Hey all. >> >> Thanks for putting up the RFC and the implementation! >> >> Having UUIDs in the core would be awesome. One of the reasons would be= >> that it's in C. That'd be faster but would also allow easier integrati= on >> with system-calls to be easier able to get the MAC-Address for a type-= 1 >> UUID f.e. >> >> But why limit UUIDs to type 3 through 5? Having security in mind is go= od >> IMHO but not implementing type 1 and 2 limits the usability and >> therefore the usefullness. Let the users decide whether they need it o= r >> not. As long as people can create SQL-Injections in PHP we should not >> use the security argument to limit usability or not implement >> standardized functionality. >> >> Especially when there is a full-fledged reference-implementation in >> userland available. In the RFC you reference ramsey/uuid yourself. But= >> why should one use the internal UUID-class/functionality when there is= a >> more powerful one in userland available? >> >> And limiting the usability and extendability of the UUID-Class itself = by >> declaring it final means that userland-code can only wrap the class bu= t >> not extend it. So userland code can not typehint for the UUID-class wh= en >> special features are necessary that would need extending the class. An= d >> as there's no interface, I can't typehint for that either. >> >> So all in all for me that's >> >> * less functionality than the reference-implementation >> * missing UUID-types (the ones that are easier to implement in C) >> * missing extendability >> >> and a naging feeling that the imlementation decides what I as a user >> actually need. >> >> That's why I can't vote "yes". >> >> Sorry. >> >> Thanks for putting in the effort and coming up with a first implementa= tion. >> >> Cheers >> >> Andreas >> >> PS: Personally I don't like a "uuid_4_create" as that would also mean >> there should be a "uuid_1_create" through "uuid_5_create" as well and >> then there also would need to be a "uuid_1_verify" through "uuid_5_ver= ify"=E2=80=A6 >> >=20 > Hi Andreas! >=20 > Thanks for your feedback. >=20 > We can easily add v1 and v2 because the class is final. It would not be= > a breaking change, or anything. v2 is pretty much useless imho, but v1 > if done right would not even harm your privacy. I'm with you there in so far that I personally don't see a value in a type 2 UUID. But there might be people that need exactly that. And as adding functionality usually isn't a BC-break that's OK. >=20 > Composition is more powerful than inheritance. You mention that you > cannot extend it to add functionality, at the same time you want to > type-hint against it. Well, in order to use the extended functionality > you need to type-hint against your extended version. Hence, there is > zero value for you in extending it other than having some place using > the extended version, and others the core version without noticing that= > it got the extended version. I'm well aware of that and perhaps I didn't express myself as clear as I should have. Imagine a use-case where a UUID-class is needed. But alongside the toString, toHex and toBinary there's also the need for a further function (let's call it toArray). So currently I need to create a wrapper arround UUID that then needs to implement all the public methods of UUID as well as the new toArray. So it works identically to UUID but it isn't UUID. And I have no way of using my own UUID-Class - as it doesnt' extend UUID - as replacement for UUID. I'd need to expose the wrapped UUID-Class to be able to retrieve it whenever some libray expects a UUID. Perhaps this gist can make it clearer: https://gist.github.com/heiglandreas/452dae591d071cbdfb78b431cb6597fa >=20 > The thing is, you should create your own value objects for your > identifiers and hide the fact what it wraps. In C, and many other > languages, we have type aliases. In PHP, and many other OO languages, w= e > use composition to achieve tha> > Whether to make it final or not was discussed, and especially Ocramius > agreed with me on this. I believe that it is the right choice. I'm not saying it's the wrong choice. I for myself would probably not immediately use it as the ramsey/uuid-package is widely in use, but I could f.e. think, that that package might start to use the UUID-class under the hood. And then that would be a case where extending could be helpful as a \Ramsey\UUID would be an instance of \UUID. The alternative would be to implement a UUIDInterface that exposes the relevant methods and that would be implemented by \UUID itself. But that's just my 0.02=E2=82=AC Cheers Andreas --=20 ,,, (o o) +---------------------------------------------------------ooO-(_)-Ooo-+ | Andreas Heigl | | mailto:andreas@heigl.org N 50=C2=B022'59.5" E 08=C2=B0= 23'58" | | http://andreas.heigl.org http://hei.gl/wiFKy7 | +---------------------------------------------------------------------+ | http://hei.gl/root-ca | +---------------------------------------------------------------------+ --aB9F09eXLVqqgrdxHmJWdBBQN2LhpxQBV-- --AjhQVh6bVLo4VxDqFjNsIoCDVXok5iqNV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQIzBAEBCAAdFiEENHMr85T+FLwCJRBgjNqPc6i4Q/AFAlmu++QACgkQjNqPc6i4 Q/Ab9w//X/XGdA0h5i9azSD8Z7KV53VIQzklb8bSuAAPsM37Qth+CfivFm/qzIJq qjR7sDPQ/Qc9Hr7B83ck8k8z9FLkc4WQyxwAuh7SL2ysy+n6W8+ms4hMbaTmejJo ZtNJOwFjFd37S5PiE3Jh6+BNv8o/6zVqDWEBw5CXm6r607+buIPPxyNStP1LLYNj uFq5F7JgfC9ZPxP2jfRLg8A7pDEv8dQsuLQlidxSJaN2jUsUMyjTSvA2KYj+qCiq 8nl8Jforr8NDZhT8M6CCQ5BpklQsGgZVk4oqQLJlK7KefvzsYj/iOKv9mkJAsOiJ z5DnFoP3XArfvKKK/wsdi4YI/MADbZKNxZLXhTPcoT/E3xAJQOyliiqseBY+cS3B 1cFu4rQ3DZSDG0jSl0msQaO5JNJ/5oxtSkyHyZ/K83XXwhUFs+Ul4YboDegougeX K6i1MIn08XO2W30Pr/CyIqRkuNszZ1sgWT/8C6kOmlqXsF1+xCBmpdQAWrX1/B0N 8WOCn2a9xXKiQuz8MbqKIcWWQ+d6ZYguvl027BH/JnUpnLXWOxTZPBDYT3SI/JOJ ZY8zzy4rH/iNoxYOPbbM6UEKanWdoJS+Cca3Lk+nXtGByGukJWjE/OHNNkhaRZoZ Cz3/0kwqPL0eTvECS/ygeJLl5KaVfY0tE4gLj2yHhDYaOvc4B8Y= =BB04 -----END PGP SIGNATURE----- --AjhQVh6bVLo4VxDqFjNsIoCDVXok5iqNV--