Named arguments via struct initialization in functions
Chris Wright via Digitalmars-d
digitalmars-d at puremagic.com
Mon Mar 7 11:06:54 PST 2016
On Mon, 07 Mar 2016 11:06:13 +0000, ZombineDev wrote:
> The compiler should detect that this call is ambiguous and would not
> allow it.
It's a potentially significant amount of work to determine that the
expression is ambiguous, or to disambiguate.
> To resolve the ambiguity, the user can write:
> foo(A{ x: 1 });
That's why I suggested it.
>> And you only need explicit type marking at the top level;
>> it's unambiguous after that.
>
> I'm not sure what you mean by "explicit type marking at the top level".
It always is unambiguous to write things like:
auto a = A{x: {y: 1}};
More information about the Digitalmars-d
mailing list