Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76529 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36842 invoked from network); 15 Aug 2014 00:47:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Aug 2014 00:47:25 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.171 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.213.171 mail-ig0-f171.google.com Received: from [209.85.213.171] ([209.85.213.171:60141] helo=mail-ig0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F9/2F-40673-B985DE35 for ; Thu, 14 Aug 2014 20:47:24 -0400 Received: by mail-ig0-f171.google.com with SMTP id l13so588214iga.4 for ; Thu, 14 Aug 2014 17:47:21 -0700 (PDT) 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=HmAv/3pBDC4P5WPNg9ZfBNgDGWijXi4B1h5u2Vyc6yk=; b=f3KBzKb5OoiX1IEO4cXG0FKjivhKZFgk09cYl9VSS7OKgds1VMZ436RcyprCVS4udA mL4l9OWkP1S03HLix8hKmVoDAon0FDjxVXyvURCfwlJ54r+3aPvaoV5HU146tZUBpTdk dHnObG2id1+LDEQ+ymmz3XxwDjLh0Bp4X72jQgQDv5X2yhnC/Sk0xG+GJ9bA3B5astdq 6Ti6JR/gvt8/7O+DyrUlpskwk4zVrMpIlfP/AtOn8md9ZCPKOVAMag7aExqsqup3XYIw 6uEHFTX3iChvCo9G/wiNn87z6CbEQ6XJxvo+/guGd1JShcJSrSwKJFX8Wu0DVTO96r3Z OrJQ== X-Received: by 10.50.79.232 with SMTP id m8mr62425131igx.0.1408063641004; Thu, 14 Aug 2014 17:47:21 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.107.4.146 with HTTP; Thu, 14 Aug 2014 17:46:40 -0700 (PDT) In-Reply-To: <53D8E693.8000406@gmail.com> References: <53D8E693.8000406@gmail.com> Date: Fri, 15 Aug 2014 09:46:40 +0900 X-Google-Sender-Auth: 1xjODzp4L4Lzd_70x6J11pspD1s Message-ID: To: Rowan Collins Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=089e013a06062621a40500a05d3e Subject: Re: [PHP-DEV] "PHP" namespace? From: yohgaki@ohgaki.net (Yasuo Ohgaki) --089e013a06062621a40500a05d3e Content-Type: text/plain; charset=UTF-8 Hi all, On Wed, Jul 30, 2014 at 9:35 PM, Rowan Collins wrote: > > - Consistent naming >> - Consistent parameter order >> - Graceful function/class/interface deprecation >> (We know what we should do for these, right?) >> > > I'm not sure if this was meant sincerely, or slightly tongue-in-cheek, but > no, we definitely don't. It comes up on the list every few months (I've > only been subscribed a short time, but this is at least the 4th time I've > seen), and the general conclusion is there isn't an easy answer, and that > adding more namespaces doesn't particularly help. > One of the discussion is mine, I suppose. This is because cleaning up API cannot be done w/o breaking some except simple aliasing. Even if there are issues in API, there isn't a consensus for feasible resolution yet. Namespace is good resolution obviously. It accomplishes compatibility and consistency at the same time even when parameters or class/interface definitions are changed. > Making small changes, such as extra function aliases, or identical > versions of existing functions with switched parameter order, just adds to > the overall confusion and list of special cases that users have to carry > around when reading and writing code. > We make small changes in versions always. API changes are small changes also. The difference is BC. Since API change breaks APP, it wasn't changed for a long time. Use of alias was proposed several times, but it wasn't optimum and couldn't reach to consensus. With namespace, user may choose. We don't force users to *new* or *old* way. There is no BC issue. It's users' choice. If we care about confusion, we may change API only with major release to minimize it. That leaves the option of making larger changes, to design a clear new API, > deliberately *minimising* the similarity to existing functions so it's > clear when you're using what. The popular option for that is migrating > chunks of functionality to OOP (as with DateTime), and to pseudo-OOP > "scalar methods" (of which there are a couple of prototypes) - not to turn > PHP into a pure OOP language, just to give us a chance to design a more > consistent library of functions. Unless we rewrite everything completely, it wouldn't be accomplished. This has been said for years (more than a decade AFAIK) and didn't happen. Therefore, new API is not feasible by history. Even when we rewrite everything, are we going to remove old API? It's BC, so I guess not. Most legacy/obscure API will remain as it is now and usable by default. New API doesn't help some time. For example, SessionHandlerInterface has some variations and has issue for adding to it. Instead having many SessionHandlerXXXInterface, simply selecting proper namespace is simpler/cleaner. Having new Session2 class only for simpler interface name does not make sense. Since we don't have new major release often, it would be good for users cleaning up API with every new major versions. Otherwise, legacy/obscure APIs will remain 10 years or even 20 years later for sure. (In fact, we have legacy APIs almost 20 years that are used commonly) Use of namespace guarantees new PHP has consistent/modern API. This will neutralize/negate all cons, IMO. cons are - New php.ini (default namesapce setting) - Legacy API can be used and remains (this is pros also) - Confusing to current users by having versions of API. (confusing API is confusing for both new and current users, too) If there are more cons, please add them. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --089e013a06062621a40500a05d3e--