Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114718 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 5405 invoked from network); 3 Jun 2021 18:14:42 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Jun 2021 18:14:42 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0ED581804AE for ; Thu, 3 Jun 2021 11:28:15 -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=0.1 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail02.x-net.at (mail02.x-net.at [83.65.141.138]) (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 ; Thu, 3 Jun 2021 11:28:14 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail02.x-net.at (Postfix) with ESMTP id 5FFFD380719 for ; Thu, 3 Jun 2021 20:28:12 +0200 (CEST) Received: from mail02.x-net.at ([127.0.0.1]) by localhost (x-zimbra02.x [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id QHyN8cUFefXO for ; Thu, 3 Jun 2021 20:28:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail02.x-net.at (Postfix) with ESMTP id 66918380B92 for ; Thu, 3 Jun 2021 20:28:09 +0200 (CEST) X-Virus-Scanned: amavisd-new at x-t.at Received: from mail02.x-net.at ([127.0.0.1]) by localhost (x-zimbra02.x [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ywlzVbrBB0yu for ; Thu, 3 Jun 2021 20:28:09 +0200 (CEST) Received: from [127.0.0.1] (91.141.0.231.wireless.dyn.drei.com [91.141.0.231]) by mail02.x-net.at (Postfix) with ESMTPSA id E3707380719 for ; Thu, 3 Jun 2021 20:28:08 +0200 (CEST) Date: Thu, 03 Jun 2021 20:28:11 +0200 To: internals@lists.php.net User-Agent: K-9 Mail for Android Message-ID: <6D61A2FD-DC80-43A5-81C2-FB19F9CB5078@dafert.at> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Policy for procedural style in new additions From: mel@dafert.at (Mel Dafert) Hi internals, After the RFC to add IntlDatePatternGenerator () was accepted, it was brou= ght up that the duplication of procedural and OO style was not necessarily/useful anymore=2E This already has some (old) precedent - in 2012, UConverter was added to e= xt/intl (https://wiki=2Ephp=2Enet/rfc/uconverter) and in 2014 IntlChar=20 (https://wiki=2Ephp=2Enet/rfc/intl=2Echar) - both of which only provide a = class, but not the procedural API=2E This was also shortly discussed on the mailing list for IntlChar:=20 https://externals=2Eio/message/79146#79167 after which the procedural API was dropped without much ado=2E When I wrote the IntlDatePatternGenerator RFC, I was not aware that the procedural API was viewed as deprecated, nor that there had been additions= to ext/intl that were purely OO=2E In the thread after its vote, it was also suggested that we add a policy t= hat forbids new additions from adding duplicated APIs, and that OO style shoul= d be preferred if possible=2E I am not sure if I am the best person to write= such an RFC, but I wanted to bring this to its own thread and provide the context I hav= e dug up so far=2E The duplication of the OO and procedural API dates back to the addition of= the intl extension to core=2E There is some discussion about it in this thread from= 2008: https://externals=2Eio/message/36775 (ignore the unrelated discussion about PHP6) The main argument at this point was that OO in PHP is a new thing, and tha= t while the OO API is objectively better, the procedural API should also be there = to lessen the learning curve for existing PHP users that are not yet familiar= with OOP=2E I would argue that 13 years later, this argument no longer holds - anyone = who has used PHP at some point since then most likely has encountered classes= =2E One open question that still remains is what we do with the already existi= ng procedural API=2E Should it be deprecated? Should it only be soft-deprecated, in that we men= tion in the documentation that the OO style is preferred, but that the procedural API = is=20 not planned to be removed? Should we just leave the procedural API as-is and live with the fact that = some classes have procedural counterparts and some don't? I would personally lean towards (at least soft-) deprecation just for cons= istency, but I would like to hear what you would have to say=2E Regards, Mel