Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116108 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 61280 invoked from network); 20 Sep 2021 13:05:55 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 Sep 2021 13:05:55 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0BBDF1804DB for ; Mon, 20 Sep 2021 06:46:37 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_HOTMAIL_RCVD2, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8075 40.80.0.0/12 X-Spam-Virus: No X-Envelope-From: Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11olkn2100.outbound.protection.outlook.com [40.92.18.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 20 Sep 2021 06:46:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f5ZjWbLnSjjFI6n8Hht/vrcdwmnpAnZ8+zqKVv5n/hwk+jnKpcHKnV9HIy4Olw2x8HMu/MzvBm8Z810BfcfWJI043Rmoj9Mx6Npc9li7gq9GeKXOigPdrfMpFao+qKctpOIce85MQwN0fOv4mVe6A506PesaYW6RsnstGj/ml7OVRa5vMj9mFn4YJSHJBru2hFIHh8vgwI/hapXAclsQthdrj18giepT2A4l+8GramoBeJ0pxYbXxb/4AXtgxibECHdu1/vB+lOVNL3yB3L/y7sqoCtsTRzofN0/NQwNxdsiYU/scT86cvKiD3WqQ0IH4Mgfnwk5Go+FfIvig95EMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=gSj1VpkbdtNhQUanrP+Z18/l62CQUvwdLYV7q/lHNGA=; b=foyGweEd99WvHx+Fx0IJi4XAWzRz7eOpVkHCqu5go+ed20yzkHnMQhzD8u6xEzfcuPTJLx0fHwfRfiCVIvKNElW9M9DMnFlS9FGVgVDjMkHmizhya73b8vK+/z8L/G2jonjJcFciIAikZW/zfISy6XxVLwK/BKDgOeJhVuv0UA3Gh/gnlt/EauPhoD46KD+oYclgmfO4pk7m5yfNcXgaMtayMLbkMZ5Ah4WoNlLKQ8WYT1WlzeUfeZgPUHOVNHfDCORv1H84CRfT/oCkTp4pOdWxFmcZxF0dpo4SoT9Djv2oL3CF2POkgnznldxTKWG4Yea+4O7rir0p2Uecy+AsmQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gSj1VpkbdtNhQUanrP+Z18/l62CQUvwdLYV7q/lHNGA=; b=qlyzZpcEX8NndAGrrvbYBwdfOs88nZ+4854CyfTENWMM7KEunjKtd/oZREPuxcgfdII9n5DL6dLv69vRq097O6yLrUiCvoK+OeQrwK5zA0dcozkX4F6JFkzPS+W9HJjpi5Nv9bb7rDmoEG2ArOnuSOwZbLleVAGhNFL0Yk1SWD85888Sclk277a+gPktr9BFtM/WKvk3U+8K4vmzZA3wLuaTJtmkKIggT6ugYMOjf0ewzpl1RJA8Z1GUaoNPvNlIpIMdKWFaUs7VoLrjDXQCwRgfAovoQPS990olND0A72lksOTrj738l+4FkevzKcqS+wSX7JiXJorjq95fc58KqQ== Received: from DM6PR07MB6618.namprd07.prod.outlook.com (2603:10b6:5:1cf::26) by DM6PR07MB8111.namprd07.prod.outlook.com (2603:10b6:5:1b8::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.18; Mon, 20 Sep 2021 13:46:34 +0000 Received: from DM6PR07MB6618.namprd07.prod.outlook.com ([fe80::7181:60db:c4d2:835]) by DM6PR07MB6618.namprd07.prod.outlook.com ([fe80::7181:60db:c4d2:835%7]) with mapi id 15.20.4523.018; Mon, 20 Sep 2021 13:46:34 +0000 To: "internals@lists.php.net" Thread-Topic: [PHP-DEV] Adding `final class Deque` to PHP Thread-Index: AQHXraUxaK1dZ0niuECOJlLUpHNcpausmdSAgABGlsg= Date: Mon, 20 Sep 2021 13:46:34 +0000 Message-ID: References: <2cc07ebd-81b0-6083-3b3d-2a678ba39784@processus.org> In-Reply-To: <2cc07ebd-81b0-6083-3b3d-2a678ba39784@processus.org> Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: suggested_attachment_session_id: d2af86b3-52f4-7ce2-49e2-6c19d2677009 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [Rwwr5zcsFvB0mJ4MtgwIV7tiHROwP/f3a4I43Dg1Vj7CVrjb4uHmQCYaNkLDP7SZ] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 20e16e97-09d4-4899-53f5-08d97c3d0fcf x-ms-traffictypediagnostic: DM6PR07MB8111: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 44a6ELl2sp3gjfiTtj2eaGYYGXKPBYiBvgomct/Or8eiL2dNRMwWuW/29YP6sYnf4zWUwDWr2rHHCdUOJC+FeY/vh2lAf2Fb1Ymeq9EumgvN23oSfgYhesr+80ShgrOHCNF7DjcPCTw/787Dqa4imq3z5ZptTE6XJs7tjbpV4RBOtwzAZIJmrfiEaT6+SCOerLSCISH2QrcgKJncFbigSsQ+FTeDjIvN1TERVX4N/jMzBYZznL42kH1JJgs53uH6pLI45zIWACq8PfJ4ph65wcsDLna6DsnEP2Sm07Tvgu853Awuo/FjF4rsECgz1DV52xmwZDHEW1jIT0waMXpV5ZcHAnzhtJTk0wNm1RW1kiumo5VuIN9xwSL51vQZzpf80POvWLA/JpM/Hr42xJYoEU9/oGTofaKnbDT/7jib/CLbSUdQpMnuvH93DliMjZ1Q0ZREBnAhcWLsPCLfZUiOxrV/EIGezUF6smYI2dYvi0GRbxHkwOoKnqwwF6akr0W5s0tTZTKuxnRjcPZFY2pdEw== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: OqcwL9kacD0zDzTkAe8OGBGGL5frKqrhNowwnkwQobCoBgVjuu5LxAICNqaePh+1eWyfVEeU1cPN0s/MsoHcilCOxmRyyAd0flnFmSkQARMU0RPbCnxtxGztdFNKSxDyacWVEnfzcSAnBHzhnO5eo3Qu+QpGHhG07qtt9b/i5L+eX6Ib/qvXrPrHhbU5Abm0w2b7/NQATEDVFpUvgVjrLw== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-35401.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR07MB6618.namprd07.prod.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 20e16e97-09d4-4899-53f5-08d97c3d0fcf X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Sep 2021 13:46:34.9321 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR07MB8111 Subject: Re: [PHP-DEV] Adding `final class Deque` to PHP From: tysonandre775@hotmail.com (tyson andre) Hi Pierre,=0A= =0A= > It seems that you are writing more than one RFC to add many data =0A= > structures. I love that you're doing that, but I suggest that you'd =0A= > normalize them all=0A= =0A= I'm not certain what you mean by "normalize".=0A= https://www.merriam-webster.com/dictionary/normalize mentions=0A= =0A= 1. "to make conform to or reduce to a norm or standard"=0A= 2. https://www.freetext.org/Introduction_to_Linear_Algebra/Basic_Vector_Ope= rations/Normalization/=0A= (no pun intended)=0A= 3. "to bring or restore to a normal condition"=0A= =0A= If you mean to make Vector and Queue's APIs consistent with each other,=0A= I plan to make changes to Vector (e.g. remove $preserveKeys, add isEmpty), = but the Vector RFC is currently on hold.=0A= =0A= If you also mean all datastructure RFCs should be combined into a single RF= C,=0A= I'd considered combining the Vector RFC with https://wiki.php.net/rfc/deque= ,=0A= but decided against combining the RFCs in this instance, because of:=0A= =0A= 1. Current discussion about whether or not to choose an alternate name for = a `Vector`=0A= 2. The fact that `Deque` has much better performance for various queue work= loads=0A= on both time and memory usage than `array`=0A= (and significantly better performance than `SplDoublyLinkedList`).=0A= =0A= Still, I may consider the approach for future RFCs, given that=0A= =0A= 1. Many developers in internals have expressed a desire for having a signif= icantly =0A= larger data structure library in core along the lines of what php-ds pro= vides,=0A= but may be uninterested in some of the individual datastructures or desi= gn choices.=0A= =0A= E.g. if 60% of developers were in favor of a sorted set and its proposed= API/name =0A= (along the lines of https://cplusplus.com/reference/set/set/),=0A= 60% were in favor of an immutable sequence and its proposed API/name (of= values) (similar to https://docs.python.org/3/tutorial/datastructures.html= #tuples-and-sequences),=0A= then with the 2/3 voting threshold,=0A= neither of those RFCs would pass but a proposal combining those two woul= d pass,=0A= despite ~95% of developers wanting some type of improved datastructures = added to core in general (I would guess).=0A= 2. This would allow seeing how datastructures compare to each other.=0A= =0A= Combining RFCs has the drawback of significantly increasing the implementat= ion, discussion, review,=0A= delays, and time involvement for the volunteer RFC authors and voters,=0A= and may lead to a larger number of last-minute concerns raised after voting= has started when more time =0A= is spent trying out the new code and looking at the RFC.=0A= =0A= > and place all new classes in a single new dedicated =0A= > namespace.=0A= =0A= My rationale for deciding against a dedicated namespace is in https://wiki.= php.net/rfc/deque#global_namespace=0A= which I've recently expanded on.=0A= =0A= The `Deque` proposal is normalized with respect to the namespace choice of = data structures that already exist.=0A= =0A= The choice of global namespace maintains consistency with the namespace use= d for general-purpose collections already in the SPL =0A= (as well as relatively recent additions such as ''WeakReference'' (PHP 7.4)= and ''WeakMap'' (PHP 8.0)).=0A= Other recent additions to PHP such as ''ReflectionIntersectionType'' in PHP= 8.1 have =0A= also continued to use the global namespace when adding classes with functio= nality related to other classes.=0A= =0A= Additionally, prior polls for namespacing choices of other datastructure fu= nctionality showed preferences =0A= for namespacing and not namespacing were evenly split in a straw poll for a= new iterable type=0A= (https://wiki.php.net/rfc/cachediterable_straw_poll#namespace_choices)=0A= =0A= Introducing a new namespace for data structures would also raise the questi= on of whether existing datastructures =0A= should be moved to that new namespace (for consistency), and that process w= ould:=0A= =0A= 1. Raise the amount of work needed for end users or library/framework/appli= cation authors to migrate to new PHP versions.=0A= 2. Cause confusion and inconvenience for years about which namespace can or= should be used in an application =0A= (''SplObjectStorage'' vs ''Xyz\SplObjectStorage''), especially for devel= opers working on projects supporting different php version ranges.=0A= 3. Prevent applications/libraries from easily supporting as wide of a range= of php versions as they otherwise could.=0A= 4. Cause serialization/unserialization issues when migrating to different p= hp versions,=0A= if the old or new class name in the serialized data did not exist in the= other php version and was not aliased.=0A= For example, if the older PHP version could not ''unserialize()'' ''Xyz\= SplObjectStorage'' =0A= and would silently create a `__PHP_Incomplete_Class_Name` =0A= (see https://www.php.net/manual/en/language.oop5.serialization.php#langu= age.oop5.serialization)=0A= without any warnings or notices.=0A= =0A= Thanks,=0A= Tyson=0A=