[nycphp-talk] studlyCaps ...
Adam Maccabee Trachtenberg
adam at trachtenberg.com
Wed Apr 28 18:47:41 EDT 2004
On Wed, 28 Apr 2004, David Sklar wrote:
> 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.)
I happened to mention that one of my secret, and never before
expressed, goals of PHP 5 was to go back and "fix" all the old broken
function names.
At which point Rasmus piped up and said he would strangle anyone who
tried to rename basic C functions, like strlen(), to str_len(). After
that, I decide not to mention it again. :)
But, seriously, I don't mind strlen(). It's things like that the
opposite of htmlentities() is html_entity_decode() that really irk
me. I also hate the sort() works in-place instead of returning the
sorted array, but that's another issue.
-adam
--
adam at trachtenberg.com
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!
More information about the talk
mailing list