George Schlossnagle wrote:


On Dec 6, 2003, at 11:14 AM, Stefan Walk wrote:


On Sat, Dec 06, 2003 at 10:59:33AM +0100, Sebastian Bergmann wrote:

PHP's internal *function names* should use _ to delimit between
words.

[snip]


And this what we should *consistently* adopt for the naming of PHP's
internal *method names*.


Why should methods differ from functions in naming? That in itself is
inconsistency...

I'm in favour of naming with underscores, simply because that was the
PHP way until now and it helps readability a lot.


This is not really true. In PHP4 there were very few internal classes, so there was not much of a standard for naming class methods. In contrast, PEAR has had a large amount of OO code in it and conforms to StudlyCaps. The whole user-space/internal differentiator argument is of course bogus because OOP relies on method overloading, so if you want to extend the internal classes in your userspace code, you are forced to adopt underscores as well.

It's hard but not impossible to extend internal classes. The workaround is to write thin wrappers with the studlyCaps convention which only just call the methods in their parents like INTERNAL_FUNCTION_PARAM_PASSTHRU. After then comes the real class that extends the functionality by extending the wrapper. So if another class extends the latter it does not have to know that the top into the hierarchy is an internal class that uses different naming convention. Anyway, this is an way to workaround, not completely clean but can help.


Andrey

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to