On Mon, 28 Feb 2011 08:15:02 -0500, Andrej Mitrovic <andrej.mitrov...@gmail.com> wrote:

On 2/28/11, Steven Schveighoffer <schvei...@yahoo.com> wrote:
This syntax already means something in D:

string action;
int times;
foo(action = "dofoo", times = 100); // set action to "dofoo" and times to
100 and pass those to the function.

-Steve


Except that doesn't do what you'd expect it to do:
void foo(ref int time) { }
void main()
{
    int times;
    foo(times = 100); // set times to 100 and pass to the function.
}

When I said "pass those" I meant "pass those values". I was not assuming ref arguments.

In any case, your syntax for named arguments is not possible. x = y is an expression, and can be used anywhere an expression can be used.

-Steve

Reply via email to