Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84337 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26578 invoked from network); 5 Mar 2015 12:00:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Mar 2015 12:00:23 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.176 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.176 mail-we0-f176.google.com Received: from [74.125.82.176] ([74.125.82.176:41286] helo=mail-we0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DF/51-18504-65548F45 for ; Thu, 05 Mar 2015 07:00:23 -0500 Received: by wevm14 with SMTP id m14so52443305wev.8 for ; Thu, 05 Mar 2015 04:00:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=xFRcoOLGa+oZvtU4ddN7osS2z0AZ5DXhPSRUYIyZ/T4=; b=nRfC7as9RPvH3REF9jz8AxaQDmhM9mrhiuoUH30uwE7/qkPGGZ/N9DzSeKpiXe+3ao eBIlrDFrtqt5JdkN9TXKxeae/p/0iKRxXR34yhDFRuSKjqr3gi0DSRNKfSMqvzQSO4wk 3sQ7YMBnL5N5hK03VlzPZSIObDT8nCfrzi0VKsOQ+gBEbZM3a3kSEAuxh4ToSxnYBtu5 opMydQuSQUQ97MRqa+R2iir4vJ2q/a6nDDgP0VJ9vLMEmQOj5nzEhfNP42UCV09gsDs6 ky1sMlT5hG9zSLBsK/GpTzSkIJpUw/Vnmo4yGJ1tV9fFMET0RMGjxEEJ4GtDMLH7vTDO WsDg== X-Received: by 10.194.60.19 with SMTP id d19mr17806152wjr.133.1425556819980; Thu, 05 Mar 2015 04:00:19 -0800 (PST) Received: from [192.168.0.159] ([62.189.198.114]) by mx.google.com with ESMTPSA id nb18sm11350832wic.3.2015.03.05.04.00.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Mar 2015 04:00:19 -0800 (PST) Message-ID: <54F84516.7000303@gmail.com> Date: Thu, 05 Mar 2015 11:59:18 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: "internals@lists.php.net" References: <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> <5D8591E2-5AE6-4B4C-AAE0-3D15523410AC@gmail.com> <54F83C4D.1020206@gmail.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Consistent function names From: rowan.collins@gmail.com (Rowan Collins) Pierre Joye wrote on 05/03/2015 11:49: > On Thu, Mar 5, 2015 at 3:21 AM, Rowan Collins wrote: >> Yasuo Ohgaki wrote on 05/03/2015 09:24: >>> I would love to have new OO APIs for variables. I also like to write >>> procedural >>> code for simple scripts. Therefore, even if we have new OO APIs, I would >>> like to >>> improve/maintain procedural functions and make them not legacy functions. >> >> I don't see scalar methods primarily as a way to make PHP more OO (it's just >> syntax sugar, at the end of the day), but as an opportunity to bring in a >> new API with real advantages. >> >> As Jordi says in the other thread, there are other things you could improve >> about the array functions beyond making the argument order match the string >> functions. If you were to sit down and design a new set of array functions >> (for instance), which were a valuable replacement for the old ones, you >> wouldn't also need to add dozens of aliases to the old set, because your new >> set could have a consistent and intuitive naming and behaviour convention. >> >> Scalar methods are just one way of designing that new set of functions, but >> you could just make a namespace of completely redesigned functions, with >> deliberately new names to make it obvious which set was being used. At that >> point, having the aliases you're proposing would be actively harmful, >> because now users would have to ask (themselves/the manual/Stack Overflow) >> "is this the new function, or just the new name for the old function?" > I will say it again a last time, in my opinion only a clean API; > object-like or real object as long as performance is not affected is > the only way I could see to actually solve this problem. > > Changing the names, argument order (pointless once we will have named > arguments, btw) and similar solutions are band aids solutions, > confusing at best, terrible at worst. It is pointless to do it after > almost two decades for some of them. For the record, I largely agree. I am open to the possibility of other *similarly clean-break* solutions, but have not seen one proposed yet. The fact that scalar methods would look completely different from legacy functions, including parameter order (because of $this), gives them a huge head-start over any other approach I can think of. If "int", "string", et al acted as real classes, and participated in an extendable hierarchy of "value types", that would be even more awesome, but entirely incidental to concerns over consistency. Regards, -- Rowan Collins [IMSoP]