I think everybody should be open to a new way of dealing with functions. The 
advantages apply to many many functions. Take for example:

mysqli mysqli_connect ( [string host [, string username [, string passwd [, 
string dbname [, int port [, string socket]]]]]] )

It would be nice to be able to do
  $conn = mysqli_connect(host: $host, port: $port);
without having to worry about anything else than the parameters I care 
about.

It's a new way of doing things, and that may be scary, but think how useful 
this can be for programmers. When you call a function, the order in which 
you present the function parameters is never interesting, except for a few 
rare cases like printf(). But unlike printf(), the functioning of a strpos() 
function doesn't require a certain order in parameters. It requires a needle 
and a haystack.

In any situation, including function parameters, I consider requiring a 
certain order where it's not needed an overspecification. Just like this is 
an overspecification:

for ($i=0; $i < count($array); $i++)
  echo $array[$i];

compared to:

foreach ($array as $element)
  echo $element;

because you simply don't need $i.
Named parameters are, like foreach, a means to reduce overspecification.

- Ron


"Lukas Smith" <[EMAIL PROTECTED]> schreef in bericht 
news:[EMAIL PROTECTED]
> Hartmut Holzgraefe wrote:
>> Lukas Smith wrote:
>>> Its sole purpose is to deal with situations where you have a 
>>> considerable number of parameters.
>>
>> well, i for one would love to write something like
>>
>>   $pos = strpos(haystack=$str, needle="foobar");
>>
>> instead of looking up parameter orders all the time :)
>
> I would specifically not go there. This would create the inconsistant 
> situation you describe. It would be fixing one past mistake with a new 
> evil.
>
> As noted the cases are not as wide as most people make it sound, also its 
> not really related to this discussion.
>
> regards,
> Lukas 

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to