Re: Re: [PHP6] Function name consistency

From: Date: Thu, 23 Jan 2014 19:31:13 +0000
Subject: Re: Re: [PHP6] Function name consistency
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-71459@lists.php.net to get a copy of this message
Pascal Chevrel wrote (on 23/01/2014):
Le 23/01/2014 18:45, Chris Wright a écrit :
On 23 January 2014 16:50, Pascal Chevrel <pascal.chevrel@free.fr> wrote:
Maybe it's a stupid idea, you'll tell me :) Wouldn't it be a good thing to issue a notice when people use the alias instead of the correct function name?
This is essentially a description of the visible effects of deprecation, and would cause a *lot* of issues in userland if this was done straight away, since there are literally millions of applications using functions that are candidates to be aliased in every page load - remember that everything, including error messages, has an overhead.
What would be the plans to have developers use the updated function names then? php.net documentation redirects from the old function name to the new function name page?
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]

Thread (46 messages)

« previous php.internals (#71459) next »