Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70650 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30941 invoked from network); 16 Dec 2013 07:22:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Dec 2013 07:22:17 -0000 Authentication-Results: pb1.pair.com header.from=tjerk.meesters@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tjerk.meesters@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.169 as permitted sender) X-PHP-List-Original-Sender: tjerk.meesters@gmail.com X-Host-Fingerprint: 209.85.220.169 mail-vc0-f169.google.com Received: from [209.85.220.169] ([209.85.220.169:57014] helo=mail-vc0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8A/F2-11425-72AAEA25 for ; Mon, 16 Dec 2013 02:22:16 -0500 Received: by mail-vc0-f169.google.com with SMTP id hu19so2952502vcb.0 for ; Sun, 15 Dec 2013 23:22:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=sfNkwbDikvDhIDNIpe1o2mhnAWWKI/iVKTIN2ssgXi8=; b=AjBBsM6WhSoEuW42dEjbh7LlJ6gJsLpkLox9KM1hl08LUCoc8osI+iKRlECTFphuuu 6pCTUMO5HUrGTajsF11Xc7beEMmgLb686WBHJVB+VlBX1dL/6BA6jdR7O6z5mVmpL70e PsOF6mAcGUOAwgmH3LgaMSMB4rMwGqTRLW8PAI1k75TGMAgGJ9/JVCzvhkkUyKP9C7IY iYSHoV4gcd5AoVgVdBdcHiY9che/hSe18OzNHc3mlXcBSWc0JWHDDZ+Tbd+Ia0jY9Teq F2HbwLbA2zXRGnYuv0X9aiSVTlGrC5lPZFnvErT0l742gLAWVVf3UA4CKsJxslF+Pwha ITxQ== MIME-Version: 1.0 X-Received: by 10.52.231.130 with SMTP id tg2mr6512643vdc.16.1387178533410; Sun, 15 Dec 2013 23:22:13 -0800 (PST) Received: by 10.58.128.33 with HTTP; Sun, 15 Dec 2013 23:22:13 -0800 (PST) In-Reply-To: <52AE93E9.7070903@cerny-online.com> References: <52ABFE84.8010404@cerny-online.com> <52AE93E9.7070903@cerny-online.com> Date: Mon, 16 Dec 2013 15:22:13 +0800 Message-ID: To: Robert Cerny Cc: PHP Internals Content-Type: multipart/alternative; boundary=089e0102f832b95cec04eda1ab83 Subject: Re: [PHP-DEV] Flexible function naming From: tjerk.meesters@gmail.com (Tjerk Meesters) --089e0102f832b95cec04eda1ab83 Content-Type: text/plain; charset=ISO-8859-1 On Mon, Dec 16, 2013 at 1:47 PM, Robert Cerny wrote: > Michael Wallner wrote: > >> >> On Dec 14, 2013 7:45 AM, "Robert Cerny" wrote: >> [...] >> >> >> >> When a PHP code base is growing over time it looks more and more >> 'diverse', because of inconsistent function and method naming in core PHP >> and third party libraries. This cannot be changed by any guidelines. The >> author of a function has the freedom to assign any name. The user of a >> function needs some flexibility in referring to a function. It should be >> possible to use 'array_key_exists', 'arrayKeyExists' or 'arraykeyExists'. >> Because of the performance impact and possible resolution conflicts this >> language feature needs to be disabled by default. >> >> Oh, I think this is not the best example, but in 5.6 you can achieve that >> with the new 'use function' feature. >> >> That is not what i mean. My proposal reaches much further. In the > meantime, i realized how to do it with minimal performance impact. Upon > parsing, PHP would need to add synonyms for function and method names to > the namespace depending on the configured referral styles. By 'namespace' i > do not mean a declared PHP namespace in the formal sense. By default no > referral styles are configured. Users can choose between 'camel case' and > 'underscore'. In this case there would be no need to normalize function > names when looking up a symbol. It would be built-in glasses feature, for > those who know the emacs mode. > > >> > This is not difficult to implement. It is only necessary to normalize >> function names: remove all but leading underscores and lower case the >> result. The likelihood of conflict is very small. >> > >> > This small change would allow coding teams to create a consistent code >> base based on 'their' guidelines. Motto: "Have it your way!". >> >> No. >> >> What is wrong with having a consistent code base all the way, also > covering legacy code? I consider this a pretty neat language feature. Consistency doesn't stop at how functions are named; there are enough functions that have an unintuitive order of function parameters, this isn't addressed in your proposal. If it were just the naming you wish to address, I would suggest writing an extension first and see how that catches on. > > Robert > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- -- Tjerk --089e0102f832b95cec04eda1ab83--