Re: Flexible function naming
| From: | Robert Cerny | Date: | Mon, 16 Dec 2013 19:00:35 +0000 |
| Subject: | Re: Flexible function naming | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70670@lists.php.net to get a copy of this message | ||
Rowan wrote:
[...] We all know that PHP's core functions are drastically inconsistent, but you need to be very sure you have a new and simple approach to solving that problem before expecting much enthusiasm for it. I cannot judge whether my solution is new, but it is for sure simple. Somebody with knowledge of the PHP source code can probably solve it within a day: when hooking a function into a namespace, calculate the synonyms and hook those in as well.
It should be possible to use 'array_key_exists', 'arrayKeyExists' or 'arraykeyExists'.This looks to me like making the language *more* inconsistent, not less. Why should different projects be able to call the same built-in function by different names? My emphasis is on consistency *within* a project, not between. I am thinking of applications mainly, not libraries.
If you're thinking more of third-party code not having matching coding conventions, then you might be interested in the work of the Framework Interoperability Group [3] who are aiming to agree a set of voluntary standards for just this kind of thing. That doesn't need any changes to the core language, just for framework and library authors to use an agreed set of conventions. Thanks for pointing that out! Yet, i am interested in a solution that also covers legacy code and the core.Robert