Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84420 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44448 invoked from network); 7 Mar 2015 23:45:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Mar 2015 23:45:33 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.43 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.218.43 mail-oi0-f43.google.com Received: from [209.85.218.43] ([209.85.218.43:33105] helo=mail-oi0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 11/31-34956-A9D8BF45 for ; Sat, 07 Mar 2015 18:45:31 -0500 Received: by oifz81 with SMTP id z81so23583527oif.0 for ; Sat, 07 Mar 2015 15:45:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=9L48D8sF0uqiij0H8ag4HTa+5NQHrz+cDwrPvkT6RFo=; b=XI4lE1yuih5cESR2kQTdbR0NCuBigOB/TAxAZHgv76H74K5Zj/FmIhlPO7YNQ52jET 55ZRNHDc1B+Zkuw93SSMQyWSUrdcXGOyWeRalwfcdFBLi2oo3N8WbPWP2AMkoJOHq08M cPTLx5Y9xVbsMgaJrsSSlrp8xvbt0EYtDsjJFnqHiYNPemzzaluc1sDlMdh5c/Yghy9T baTExv8HQGjW6LigU4LOy9CLD3qu3KPP7IiDZ6W5LqWFjmuwV0yMLUpZ3gH7NPXsXv2/ 4D4a9jJ+xPt/bVi+kO0Gzp3N4A2Cv4y+VbjsWQJqv4XcRTJ+VuQNWLDrilZNJvQ8hLuY czQg== X-Received: by 10.202.108.137 with SMTP id h131mr15423117oic.90.1425771928220; Sat, 07 Mar 2015 15:45:28 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.202.58.2 with HTTP; Sat, 7 Mar 2015 15:44:48 -0800 (PST) In-Reply-To: <54FB3175.3000308@luni.fr> References: <1FCB68B8-3E55-4B5D-B805-9D92D848A3A1@gmail.com> <5D8591E2-5AE6-4B4C-AAE0-3D15523410AC@gmail.com> <54F83C4D.1020206@gmail.com> <54FB3175.3000308@luni.fr> Date: Sun, 8 Mar 2015 08:44:48 +0900 X-Google-Sender-Auth: Ly390vnZwKeot0alIpjHm3GAqCM Message-ID: To: =?UTF-8?Q?Gr=C3=A9gory_Planchat?= Cc: "internals@lists.php.net" , Pierre Joye , Arvids Godjuks , Rowan Collins , Larry Garfield Content-Type: multipart/alternative; boundary=001a1142d8cc4ff8860510bb65e6 Subject: Re: [PHP-DEV] Consistent function names From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a1142d8cc4ff8860510bb65e6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Gregory, On Sun, Mar 8, 2015 at 2:12 AM, Gr=C3=A9gory Planchat wro= te: > Le 07/03/2015 02:39, Yasuo Ohgaki a =C3=A9crit : > >> We may provide new names and new parameter order in new namespace. >> The difference is "alias" or "namespace" basically. I don't object to us= e >> namespace for it at all. In fact, I would love to have it even if there = is >> issue >> like writing extremely difficult to read code is possible. >> > > Hello all, > > I join the thread as a seasoned PHP developer (in user-space), not as a > PHP core developer. I work since 6 years now for large companies websites > and I write PHP scripts and programs since 15 years now. I would like to > bring my brick to this wall. > > I follow the thread since a few days now and I have some suggestion which > can resolve both the functions naming issue for some of you, some others > suggested to have an object-oriented API and some are fearing massive BC > breaks. > > I read Larry Garfield and Pierre Joye suggesting the idea of an > object-oriented API, maybe others suggested it already as long as this id= ea > is running here since a few years. > > I wrote these days the start of a spec of an API, it is far from being > finished for the scalar types but the array part is almost finished and > integrates every method documented in the current array API. > > https://github.com/gplanchat/php-oop-api > > Suggestions are welcome, you can fork and comment. I don't have the > ambition to rewrite all the PHP core, but just using the existing > underlying code and applying it a new interface in the userspace. > Additionally to the current API. > > I use the ideas from the [PECL SPL types extension](http://php.net/ > manual/en/book.spl-types.php) and Nikita Popov's [scalar objects > extension](https://github.com/nikic/scalar_objects). > > Those enhancements could be part of one RFC or several, as the amout of > work can be massive. The essential point is that this refactoring *MUST* = be > using only existing code in the core. It *SHOULD* make it appear > differently to the user. The risk is then lower than a full refactoring. = It > is, IMHO, the best compromise for the entire PHP community. > > There are several goals and possibilities behind this : > * Create a consistent and complete API that can satisfy OOP programmers > and give them a more powerful API > * Do not create BC breaks on these core types, the ZVAL struct is > unchanged and the IS_STRING, IS-DOUBLE, ect... are still used as usual > * Make it possible in a future release (let's say PHP 8, 9 or 10+) to > deprecate and even remove the old API > * Build easily encoding-aware strings (binary, ASCII, UTF-8, UTF-16BE, > UTF-16BE, UTF-32, JIS, Big5, ect...) > > Thanks for reading. > Nice post indeed! I'll insist to keep procedural API, though :) We are better to have unified encoding for simplicity. Multibyte string comparison is complex, so it's better to have NFC/NFG normalized UTF-8 strings as the default. Other encodings can be supported as conversions. We are better to have consistency between procedural functions and OO methods where it is possible. I see a few inconsistencies like "hasKey", "has", "recursiveWalk". These names could be adjusted by function and/or method. This RFC could be made so that it leaves space for consistency. i.e. Do not touch variable related functions to have consistent names for both procedural functions and OO methods in the future. Or we may discuss/adjust consistency fully. The change may be introduced PHP 7.x or even PHP 8. We may take time as long as it takes and have votes for multiple RFCs that have consistent names/parameters at once. The latter is better choice. IMO. My objective with this RFC is to make sure to have consistent procedural function names "someday" so that PHP will have nice and consistent procedural functions forever. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a1142d8cc4ff8860510bb65e6--