this is almost a workaround for the lack of named parameters
J
noname at notavailable.notavailabe.com
Tue Mar 26 15:26:03 PDT 2013
On Tuesday, 26 March 2013 at 12:14:08 UTC, Jacob Carlborg wrote:
> On 2013-03-26 10:31, renoX wrote:
>
>> Interesting, the "doesn't not support passing the arguments
>> out of
>> order." can be seen either as a (temporary or not)
>> implementation
>> limitation OR as a feature.
>
> I would guess it was easier. At least the change is very small.
> Smaller that I would have imagined.
>
>> The things to check is how this feature would work with
>> optional
>> parameters..
>
> Good point.
Tested this. Seems to work fine with optional parameters.
import std.stdio;
void test (int a, int b = 24, int c = 12, int d = 6, int e = 3)
{
writeln(a);
writeln(b);
writeln(c);
writeln(d);
writeln(e);
}
void main ()
{
test(a: 1,
2,
c: 9999);
}
// output:
$ ./namedarg_defaults
1
2
9999
6
3
More information about the Digitalmars-d
mailing list