NYCPHP Meetup

NYPHP.org

[nycphp-talk] studlyCaps ...

David Sklar sklar at sklar.com
Wed Apr 28 18:37:12 EDT 2004


Adam Maccabee Trachtenberg wrote:

> On Wed, 28 Apr 2004, Mark Armendariz wrote:
> 
>>I would personally like to see it standardized throughout the entire
>>language.  I have no preference to either, personally, but I definitely
>>think consistency is important in any language (spoken, written, or coded).
> 
> 
> We're not renaming all the function to remove underscores. Period.

I don't think it would help much anyway. There is enough inconsistency 
in PHP's function namespace even without any kind of Grand 
studlyCaps/underscore Reorganization.

E.g. str_replace() and strlen(). In a perfect world they would be 
str_replace() and str_length() or strrepl() and strlen() or 
stringReplace() and stringLength() or whatever parallel pair floats 
one's linguistic boat.

But strlen() is from C (and PHP's C and Perl similarities are one of 
things that makes it easy to learn for programmers) so changing that fu 
nction's name would be a Bad Idea. (Adding an "alias" so that you could 
write either strlen() or stringLength() or whatever is an Even Worse 
Idea. You may only use one in all your programs, but you need to know 
how to read all the synonyms in case someone else uses one.)

Consistency surely is important in any language (human, computer, or 
otherwise) but is an impossible goal in any language (human*, computer, 
or otherwise.)

Human languages are wrought with irregularities (this sentence is 
Exhibit A) because they have diverse heritages, and are constantly 
changing because of the conscious and unconscious activities of their 
speakers.

Computer languages seem a little more rigid because we have something 
like the PHP interpreter acting as an uber-Académie française and 
enforcing rigid grammar and vocabulary rules. But they're subject to the 
same forces that change them over time.

So, um, I suppose the point of this off-topic quasi-rant is just to say 
that hoping for "consistency" is an ultimately fruitless quest. Sure, 
there are larger and smaller levels of confusion that can reign 
depending on what kinds of choices are made as to PHP's direction but 
perfect standardization is a pipe dream.

David

* Except Esperanto? I don't know much about it but perhaps a 
constructed-from-scratch language like Esperanto that nobody actually 
speaks** might qualify.

** Apologies to any Esperanto devotees who may be reading this. Yes, you 
may speak Esperanto to other Esperantees at the annual Esperanto 
convention, but that doesn't qualify as "actually speaking" it. When you 
can go to the store*** and buy a candy bar in Esperanto, then I'll 
reconsider.

*** Excluding the snack bar at the Esperanto Convention.




More information about the talk mailing list