Re: Re: [PHP6] Function name consistency
| From: | Larry Garfield | Date: | Fri, 24 Jan 2014 01:11:12 +0000 |
| Subject: | Re: Re: [PHP6] Function name consistency | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-71469@lists.php.net to get a copy of this message | ||
On 1/23/14 1:31 PM, Rowan Collins wrote:
Therein lies the whole problem with adding more aliases - it just makes things more inconsistent, as developers can use (deliberately or accidentally) different names for the same function. I still have to think a moment when I see sizeof() or print, rather than count() or echo - let alone having to remember which version of PHP introduced which alias so that libraries don't break when deployed to older servers. I think it's far better to have replacements for whole sets of functions that are clearly "new and shiny" - be that OO strings and arrays, or just namespaces for extensions like mbstring. In fact, a namespace for mbstring could allow a much cleaner version of the "override normal string functions" system, because you could just "use" the namespace, and have functions with overlapping names... Regards, Rowan Collins [IMSoP]Agreed. Simply aliasing a bunch of functions offers no useful value, but does increase confusion. ("Wait, do I use strcmp() or string_compare() on this project? What version are we on again? Oh, look, this library uses both. Must have been different devs. FML.") If we're going to do anything, be aggressive and far-reaching with it. Build a proper language-level OOP design for string/array manipulation. We have enough functions lying about. Don't add more. --Larry Garfield