Nice start (your url (function list) doens't seem to work yet by the way). Just my 2 cents:
I don't like the '2' at all. I'd rather see nltobr() and dectohex() than nl2br() and dec2hex(). I do like the idea of loosing all underscores (but I bet there will be quite a number of developers here who want to keep underscores). Removing underscores though, would open 2 possibilities: - studlycaps - no more randomness in underscore usage in function names (as you so wonderfully explained) Since function names are case insensitive anyway, it won't be a problem at all, and it'll provide word-boundaries just like underscores do today: strPos() arrayMerge() isInt() imageCreateFromString() changes to make this happen: create alias array_merge() for arrayMerge() create alias is_int() for isInt() strpos needs no change, except that it will officially be strPos() imagecreatefromstring needs no change, except that it will officially be strPos() The situation will end up 100% BC and aliases can be removed in PHP 7 or later. - Ron "Michael Cordover" <[EMAIL PROTECTED]> schreef in bericht news:[EMAIL PROTECTED] > > > Sara Golemon wrote: >> I say this with no degree of sarcasm or ill-will: Create a formal >> proposal. > > Well, you asked for it ;). > > Goals: > - remove confusion when a user thinks about a function's name > - develop consistency throughout the language > - be backwards compatible as much as possible > > The basic idea began as "rename confusing functions but keep their old > names as aliases to the 'preferred' version with a view to eventually > removing the old ones". Well, let's take a look at a few things. Using a > little bit of counting code and get_defined_functions(), it appears that > there are 510 internal functions containing underscores and 304 which > don't (PHP 5.0.4). The obvious solution appears to be to change all > functions to use underscores. > > I went through the function list in an attempt to do just that. Many > functions convert reasonably well - chop() remains chop(), > escapeshellarg() becomes escape_shell_arg(). A fair number, however, were > not quite so friendly. Should fclose() and feof() remain as such or > should they become f_eof() and f_close()? fileatime() to file_atime() or > file_a_time()? Is basename one word or two? There are also a fair number > of functions like nl2br() - nl_2_br() would be silly. > > It seems to me, therefore, that we should get rid of the underscores. Yes, > this means changing a lot more functions around, but adding underscores > will just make function names MORE confusing where there's ambiguity - and > that's what we want to remove. It's one of the big complains about PHP, > that ambiguity. Furthermore, we don't want to make substantial changes to > function names - doing things like nl2br() -> nl_to_br() will confuse more > people than necessary and may conflict with existing user-defined function > names. > > So, let's list functions and replace out all the underscores. We get: > http://mjec.net/php/functions.html > > Well, that's not actually consistent with PHP overall. cal_to_jd() > becomes caltojd() - that should really be cal2jd() to stay consistent. So > lets do that. And at this stage I also added some checking to make sure > there were no functions being duplicated. Well, there was one - > diskfreespace() is an alias of disk_free_space(). That is, however, the > only internal conflict I could find. That listing is at: > http://mjec.net/php/betterfunctions.html > > There are a few functions I think need actual renaming, for consistency: > bindec() -> bin2dec() > decbin() -> dec2bin() > octdec() -> oct2dec() > decoct() -> dec2oct() > hexdec() -> hex2dec() > dechex() -> dec2hex() > Those are the only ones I can think of at the moment. If you can think of > any more, please tell me. > > So, let's look at where we are now. We can rename all 510 > underscore-containing functions to not using their underscores, a > relatively easy transformation. Similarly, changing '_to_' to '2' before > killing underscores is trivial. Those bindec() -> bin2dec() etc have to > be done manually. Then alias the old versions to the new function names. > > So, if a user knows a function's name they don't have to worry about > underscores any more. The language is consistent with respect to > underscores - there aren't any. But you can still use all the old > function names, so we retain BC. I believe the suggestion was to remove > this by PHP 8, which sounds reasonable. > > What's wrong with this proposal? Well, a few things. Firstly, it doesn't > make all function names intuitive - there's still the word order problem. > Secondly, it's a hell of a lot of work to change 510 function names and > then alias them. > > Well, the first one just needs someone to go through all 813 distinct > functions (not 814 because diskfreespace() is in there twice) and note > which order they're in, then reorder them. I'll do this when I've got a > bit more time on my hands - probably early next week. > > The second bit is fair enough, yes. It might be automatable? I'm not > sure and will look into this once I get a proper internet connection back. > > The One Big Argument against the more wide-spread use of PHP is that it > doesn't have consistent function names. If this can be fixed, well, you > bewdy, as we say in .au. All I have to remember is haystack, needle > except in_array() and array_search(). > > And those are my two cents. > > -mjec > -- > http://mine.mjec.net/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php