Re: Resurrecting the Function Renaming Thread

From: Date: Wed, 07 Feb 2001 18:18:56 +0000
Subject: Re: Resurrecting the Function Renaming Thread
References: 1  Groups: php.qa 
Request: Send a blank email to php-qa+get-2299@lists.php.net to get a copy of this message
At 18:15 7.2. 2001, Sterling Hughes wrote the following: -------------------------------------------------------------- ><?php >if (str_len($x) == 0) { > echo "String length is 0"; >} >echo str_len($foo); >$bar = str_len($foo); >?> > >Ugggghhhhhhhhh. > >I don't think any language should reccomend a syntax like that. What's so wrong with it? I think it's ok. Note: I'm aware my POV would be very likely much different if I had used C for a couple of years. I'm not a C coder. While this disqualifies me in many areas (and I regret it), it allows me to see that there are lots of people who can't tell C from a haiku. You know, the problem with this mailing list is that most of the participants are PHP developers which means they're C coders. And they're (you are :) obviously biased. That's not to imply anything disregarding or what. But it might be interesting to ask the 'laymen' in php-general or php-windows. I guess either side would be surprised: either those in favor of renaming or the "C guardians". It might turn out 8 out of 10 people don't know C, and don't give a damn if strlen has been strlen in C since '60. Or I might realize that an average PHP user is someone who's written hundreds of thousands of C code. I don't know. My experience from a local PHPUG suggests that the 8 to 2 rate is actually favoring the C coders. >strlen() is fine, its a standard function that's been in PHP and is in many >languages. There's no reason to blindly start renaming PHP functions to >conform to a naming standard. Ok, yes, fine, for some functions it does >make sense, all mysql functions, should be and are prefixed with mysql_*. >But in some cases it does. A function that tokenizes strings should be >strtok() why? what are the consequences with regard the language as a whole? >a function that gets the length of a string should be strlen(). A >function that add's slashes to a string should be addslashes not >str_addslashes() > >which looks better: > >$str = AddSlashes($str); > >or > >$str = str_addslashes($str); > >??? IMO the latter. >I'd say it would be best to leave php's basic functions alone This might be a solution as well. I'm open to other opinions. Define "basic function" then. >(maybe one or two)... I very strongly disagree. I even think that if the conclusion will be leave str* as they are, I would raise the question of renaming str_pad (and the other few str_* functions) to be changed to strpad etc. There should be some logic. Whatever it is. >And maybe look at the extensions which are mostly ns protected. > >-Sterling Thanks for your input. ____________________________________________________________ Cynic: A member of a group of ancient Greek philosophers who taught that virtue constitutes happiness and that self control is the essential part of virtue. cynic@mail.cz

« previous php.qa (#2299) next »