Andi Gutmans wrote:

> The alternative solution of allowing foo(,,4) would work and can probably
> be implemented easier (it might still lead to a tiny slow down but
> probably negligable); however it does look kind of ugly and it'll be quite
> confusing if there will be lots of commas.

 

function calls with lots of parameters look confusing anyway,
and functions with more than 2 or maybe 3 optional parameter even more so

but having the ,, syntax and default parameters for left out optionals
at any place in the paramter list instead of the last ones only would
ease at least the implementation of functions that have two alternative
optionals as a lot of

   if($param_n===null) $param_n="default_n";

statements could be saved


> We are probably best off leaving things the way they are and in the very
> few cases where it is really needed to pass arrays. However, this should
> really be the exception to the rule when there is no other alternative
> because building the array and later on checking for values inside it is
> much slower than regular parameter passing.

what about giving both alternatives then? i'm getting back to my mktime
example again, where the old behaviour should stay for BC reasons but
which could have mktime(array("day"=>1,"month"=>1,"year"=>2002)) as an
alternative interface

no harm is done if both are documented with a note that the old
interface is faster while the new one is more readable and doesn't
always fool us stupid germans who are not used to month/day/year
dates ;)

-- 
Hartmut Holzgraefe  [EMAIL PROTECTED]  http://www.six.de  +49-711-99091-77




-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to