Allow empty field function arguments for default?

ixid nuaccount at gmail.com
Thu Apr 19 07:13:42 PDT 2012


I put this here because it's probably a flawed idea. A 'learn' 
level suggestion.

At present function arguments that you want to default must go at 
the end like so:

int fun(int a = 1, int b = 2, int c = 3)
{
     return a + b + c;
}

fun(4); //Modifies a

where the default fields can only be fields after any argument 
provided. Why not allow something like:

fun( , 4, ); //Modifies b
fun( , , 5); //Modifies c

for when you want to call fun with other fields not being 
default? This would seem more flexible and pretty clear what is 
intended.


More information about the Digitalmars-d-learn mailing list