On 06.04.2010, at 14:16, Richard Quadling wrote:

> Hello.
> 
> A suggestion I would like to make is to allow for nothing to be
> supplied for defaulted parameters.
> 
> I suppose the easiest way of describing this issue is with the
> following code ...
> 
> <?php
> function foo($bar, $baz = 9, $buzz = 10) {
> return "$bar $baz $buzz";
> }
> 
> // Whatever is supplied for $baz will be used for $baz.
> // User has to know the default value of $baz rather than just
> allowing the default value.
> echo foo(1, 9, 20);
> 
> I don't know the stylics on using default parameters, but for the user
> to have to know the default value would sort of make the default
> redundant.
> 
> 
> // Passing nothing at all could be one option.
> echo foo(1, , 20);
> 
> but who would want to see ...
> 
> echo anotherfoo(1, , , , , , , 20);
> 
> for example.
> 
> 
> Maybe a new keyword ... (ala SQL syntax).
> 
> echo foo(1, default, 20);

another solutions is to use named parameters as suggested in one of the recent 
discussions.
named parameters allow you to specify only those parameters which you need and 
not care about order of parameters

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to