> I think PHP 6.0 provides an excellent opportunity to rectify a huge number > of frustrating inconsistencies; it would be a shame not to make the most of > this. > > > > The two biggest inconsistencies raised by users and "language comparison" > groups are a) function argument order, and b) function naming. > > > > Granted, swapping the arguments will be nightmarish for the users. However, > we have a long time to discuss possibilities to alleviate the problem. I > agree with Jani, a list of inconsistencies should be compiled and discussed. > > > > If it is decided that swapping the function arguments around would be too > cataclysmic for upgrading users, we should at the very least institute a new > strict function naming policy. > > My favourite example of inconsistency is htmlentities and > html_entity_decode. These are easy to fix, and a relatively easy BC break > for the user to deal with. > > > I suggest we extend Jani's previous suggestion; by including a list of > function name inconsistencies in the discussion. ppl might use the dirty but fast function instead of a wrapper which is slow and have to remember new function name > so there is a "declare". but even with "declare" ppl writing new code while still have to maintain old code get crazy
although php-internals guys should jump out and say "hey, php is not java. not everything is object", but here's another idea. still, with the "argument swaping table" but write as a object alike syntax instead: $str = $str->str_replace($needle, $replacement); $str = $str->preg_replace($regex, $replacement); $str is scalar, NOT and never an object. and there's no auto boxing/unboxing, no properties, as no "new String()" (to make php-dev please) ========= wish about lamda function constructor: having to write a callback at far away, and use it in preg_replace_callback, make writing/maintain code harder function callback_1($matches) { } other callbacks here.... $str = preg_replace_callback("/../", "callback_1", $str); $str = preg_replace_callback("/../", "callback_2", $str); etc. using create_function() is 1. quite confusing as the code has to be in string 2. might also lead to code injection as eval(). 3. cannot be cached/optimized by apc or so. (md5 the whole code string as a key?) $start = .. $end = .. $str = preg_replace_callback("/../", "callback_1", function ($matches) { return $start . $matches[1] . $end; }); is really nice. but "scope" in such function need to be discussed. accessing variables of parent function inside lamda(child) function is useful most of the time. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php