Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71623 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47497 invoked from network); 27 Jan 2014 03:59:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Jan 2014 03:59:39 -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.217.175 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.217.175 mail-lb0-f175.google.com Received: from [209.85.217.175] ([209.85.217.175:44116] helo=mail-lb0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B0/BD-12631-9A9D5E25 for ; Sun, 26 Jan 2014 22:59:38 -0500 Received: by mail-lb0-f175.google.com with SMTP id p9so4064531lbv.34 for ; Sun, 26 Jan 2014 19:59: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=W7EgIAPB0w1ONhN2/bYYNTFEVDdMXvSl/wqlWUr8+Jo=; b=q6Kzw1P3jU/9t0WxmeLX+/KCd3a+iiPgWUHT/1uaZolIJCHf/vJjjrHlMGClAROHT3 HsGbOgA+afpS7p0lU8O6uBohFZOmSab26c4Q/3dWpFuC9WgQJG6sixQ6Y2daUgIL6JZq 4sCd/V9pvs5jZazjOC9v1KSwxBn9kj+labGHbv5k6UTaucQQwMmijLHLeXMd6rzslor8 meDEGsPF9SsWBUQlyTUxal+qFXKfbnGowFL+cqYoXjMXlPglNgGgpUWL58Fba4HPjCS8 dlU9GC9wCB0rZkKsfZLMoWVhqNlAJpyUJPlh/K2OHJ+Ws9D/vW/yUPEbcAjPn8AHlFnG n9PA== X-Received: by 10.112.151.42 with SMTP id un10mr15534014lbb.7.1390795174509; Sun, 26 Jan 2014 19:59:34 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.132.134 with HTTP; Sun, 26 Jan 2014 19:58:54 -0800 (PST) In-Reply-To: <52E5563A.4070701@gmail.com> References: <7E.A3.39789.25841E25@pb1.pair.com> <12.A5.39789.B7851E25@pb1.pair.com> <52E16E01.7070401@gmail.com> <52E1BDB0.6050406@garfieldtech.com> <52E40F7E.3050001@gmail.com> <52E5563A.4070701@gmail.com> Date: Mon, 27 Jan 2014 12:58:54 +0900 X-Google-Sender-Auth: -qheiZC8Fi6SnBrmINJ8t2izedo Message-ID: To: Rowan Collins Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=047d7b3435b65502c504f0ebbc60 Subject: Re: [PHP-DEV] Re: [PHP6] Function name consistency From: yohgaki@ohgaki.net (Yasuo Ohgaki) --047d7b3435b65502c504f0ebbc60 Content-Type: text/plain; charset=UTF-8 Hi Rowan, On Mon, Jan 27, 2014 at 3:38 AM, Rowan Collins wrote: > On 25/01/2014 23:36, Yasuo Ohgaki wrote: > >> For example, I've made pg_query() long time ago while there was pg_exec(). >> http://jp2.php.net/manual/en/function.pg-query.php >> >> At that time, there wasn't a prepared query. Now we have pg_execute() to >> execute >> prepared query. >> >> I guess not many people consider this was harmful. >> > > It's certainly true that aliases are not automatically a bad idea. There > might have been a bit of confusion when it was introduced and people > thought the functions did different things, but in this case, the old > function probably wasn't something people typed on a day-to-day basis. I guess many users don't type native module function names now a days, since most users are using some kind of framework. > > I suppose most pgsql users are pleased these new names and aliases. >> > > Actually, *most* pgsql users have probably never used half of those > functions, and the other half are used once or twice in a rarely-edited > abstraction layer, and if you asked someone how many underscores were in > the names they would look it up in the manual. These are not the kind of > functions usually mentioned regarding general consistency of function names > - the examples given are often widely-used functions like string and array > utilities. > These would be typed by many users. > These are going to be used all over the place in shared code, and > applications supporting older versions of PHP will need to carry on using > old names, applications migrating will have to decide if it's worth finding > and replacing them all, and new applications will have to decide if the new > names should be adopted as official coding standards, based on what other > applications the coders are working on. I understand this argument. Since we have short release cycle and rather short life for a release, this is short term disadvantage. They may keep using aliases functions also. > Adding aliases for cleanup does not worth the effort now. I agree. >> However, it does for future. IMHO. >> > > The problem is, that there is no neat dividing line between "short term" > and "long term". One blurs into the other, and different people were > perceive the pace of change differently. A long overlap with multiple names > for everything has its costs, and a short overlap with lots of breaking > changes also has its cost. > Keeping inconsistent names have its cost also. > Note that the alternative I and others are advocating is not "no change", > but "radical change" - rather than introducing different names for > functions that work in exactly the same way, introduce new ways of > achieving the same thing, with a nicely unified structure. This makes it a > much easier to decide and announce "we're going to use OO-style strings" > (or whatever scheme is invented). It's nice to have them. Even when we have nice OO style API, old functions will remain forever, probably. > > Name collision by adding aliases is not much issue with namespace. >> > > You keep bringing this up, but I for one have never mentioned it as an > issue with adding aliases. My point is entirely about the value and cost of > having multiple names with identical meaning. > Good! I realize cost of having aliases also. The only difference here is you think cost of alias outweigh while I think cost of inconsistent names outweigh. > I mentioned using namespaces (in the technical sense) as a way of > radically rearranging functions (e.g. array\filter(), array\sort\callback\associative() > but better thought out than that) but that's nothing to do with name > collision really. > > > Anyone who don't care cleanup, they don't have to care and keep >> using old names. >> > > Don't forget that a language needs to be easy to *read* as well as easy to > *write* - if one person ignores the new names, but then reads code using > them, that code is harder for them to understand. > IMHO, aliases would not affect readability. Users would understand what word_wrap() and wordwrap() htmlspecialchar and html_special_chars() and so on means. I still check correct name see if it has "_" delimited name or not for rarely used functions. (I don't use IDE to write PHP code ;) In short: there may be particular cases where the advantages of adding an > alias outweigh the disadvantages, but it's by no means automatic, and doing > it across the whole of PHP is not going to automatically be good for the > language's future. I agree that automatic aliasing would not be good. String and array function names needs more discussion. GD function names may be aliased automatically, for example. We should discuses if we are going to add standard name aliases to module functions or not, perhaps? Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --047d7b3435b65502c504f0ebbc60--