Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84305 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29548 invoked from network); 4 Mar 2015 21:28:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Mar 2015 21:28:37 -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.216.176 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.216.176 mail-qc0-f176.google.com Received: from [209.85.216.176] ([209.85.216.176:42787] helo=mail-qc0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F1/6A-56703-40977F45 for ; Wed, 04 Mar 2015 16:28:37 -0500 Received: by qcwb13 with SMTP id b13so2158818qcw.9 for ; Wed, 04 Mar 2015 13:28:34 -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=STQWUBHCa4UW0/Gf0mvI2DYSi6Ff4JgKKEtP5NEPTXQ=; b=DvNRmjQvBZDZdc647msLU3SGZXGI4rfWREcPcdVn+x/vAM7jyTPH+Z9Ht+LAwbYXtS YzCjGG/NiNQ5LSGt0ChDmM2RpyWMrbgJa11PiEmRAzwVyhwrk2ZSZcpWt/4Ki5USHSOG K8vO/rzsR4tAicm7C/XgGzB00cjZzF2TYYdzViU6LeGZ7qGhYwZybh56Av5G5BhMVugQ ymuPzkvH5P8VGCayUb3uJpgPA1+tZo+opecNvOk/7Qf+TWM2oDHl43JCDb9S5QNFpNTn QUKu8fylGdir7TCvQDWvH/qaba8Ea2DDotOja/92s7PLXcLGwi8R5zPqGvMkIQB0yxdG IcvQ== X-Received: by 10.140.108.116 with SMTP id i107mr7942123qgf.73.1425504514661; Wed, 04 Mar 2015 13:28:34 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.229.198.8 with HTTP; Wed, 4 Mar 2015 13:27:53 -0800 (PST) In-Reply-To: <1FCB68B8-3E55-4B5D-B805-9D92D848A3A1@gmail.com> References: <54F4E29D.7080501@garfieldtech.com> <54F4E93C.80206@gmail.com> <54F4EBEC.2090702@garfieldtech.com> <54F4F3FC.6060501@fischer.name> <54F4FDFB.8010701@lsces.co.uk> <54F5895D.3090002@gmail.com> <554F0C3F-770F-4694-A5AB-FDC54FCCBF00@gmail.com> <1FCB68B8-3E55-4B5D-B805-9D92D848A3A1@gmail.com> Date: Thu, 5 Mar 2015 06:27:53 +0900 X-Google-Sender-Auth: 3T50RVGG9seWiyZscINrklJzbfk Message-ID: To: Rowan Collins Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a113aadc238f19a05107d223b Subject: Re: [PHP-DEV] Consistent function names From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a113aadc238f19a05107d223b Content-Type: text/plain; charset=UTF-8 Hi Rowan, On Wed, Mar 4, 2015 at 6:16 PM, Rowan Collins wrote: > Several of the costs I listed are for new users, and several will continue > indefinitely if we don't remove the old names, and are therefore long term. > > Could you be more explicit in the benefits you see? I.e. day to day, how > will users lives be better with these new names? > When I start programming with PHP at 2000, I remember that I was confused function naming convention a lot. I hope that current new users do not have such confusions, but they probably feel inconsistent name as issue because it does not look right. Even if IDEs suggest "right" names, I just feel wrong. I guess there are not few people feel same way. People who prefer Ruby likes it because it's not only have shorthand notations but it is predictable in many ways. In PHP7, we finally have uniform(predictable) evaluation order! predictable foreach! why not predictable function names? Since PHP does not have predictable(consistent) names even for most basic functions, function names are not predictable. It makes harder for new PHP developers to get used to. As you mentioned, the changes may cause more confusions in short term. I agree with this. Change causes confusions always more or less... For me, it is a choice whether - we'll have naming confusion forever or - we'll fix it even if there are some confusion in short term resolve it in the long run. >- PHP has API inconsistency even for most basic APIs like phpversion(), > >htmlspecialchars(), etc > > - Even bundled modules have non standard function names. > > - API parameter ordering is inconsistent. > > - Return type for errors are inconsistent. e.g. Wrong number of param > >returns NULL, while others return FALSE mostly. > > For me, argument order and return inconsistency is a much worse problem > than name inconsistency. Unfortunately, it's also harder to fix without > massive BC breaks. Again, this leads to the conclusion of replacing the > entire legacy API, rather than trying to patch over it. > I agree fully. I wish we have FALSE for wrong number of parameters. We should try to provide nicer and consistent new APIs. However, old API will be kept regardless of new APIs because we care compatibility. We still have "is_writeable()" (This is typo function) alias for compatibility, for example. I'll try to modify document system so that it can handle aliases more nicely. e.g. Do not list aliases in function list, but document them in referred function. htmlspecialchars() is documented in html_escape() and make search system find html_escape() by searching "htmlspecialchars". If this is done, we don't have many aliases listed in manual page. I also think having two names for every function will count as a negative > to the kind of people who write these matrixes, and the fact that it was > done to fix a previous negative won't change that. > Keeping legacy names is almost the same as keeping "is_writeable()" for me... I'll try as much as I can, like adjusting manual and search system, so that PHP appears to have consistent function names. This would help people to reconsider. We cannot remove all issue at once. We are better to adopt incremental improvement, aren't we? Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a113aadc238f19a05107d223b--