Flexible function naming

From: Date: Sat, 14 Dec 2013 06:45:24 +0000
Subject: Flexible function naming
Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hello,

I am new to the list. I have been a PHP user for 8 years. I am a progammer for 30 years. Initially i wanted to post this as an RFC, but could not figure out how to register. When accessing [1] i get 'Command disabled: register'. I did some research, but the archives are vast, so please accept my apologies in advance if this has already been discussed.

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.

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!".

Best regards,

Robert Cerny

[1] https://wiki.php.net/start?do=register


Thread (14 messages)

« previous php.internals (#70634) next »