Named constructors
JN
666total at wp.pl
Fri Jan 11 11:24:15 UTC 2019
On Friday, 11 January 2019 at 07:53:56 UTC, rikki cattermole
wrote:
> On 11/01/2019 3:35 AM, JN wrote:
>> Also, named/keyword arguments shouldn't be an issue in regards
>> to overloading and argument order. Every language I know that
>> has named/kw arguments allows either only keyword arguments or
>> keywords arguments at the end of the argument list. You can do:
>>
>> foo(x=10)
>> foo(10, 20, z=30)
>>
>> but you can't do:
>>
>> foo(x=10, 20)
>>
>> because it'd be ambiguous.
>
> Actually every example there is ambiguous and problematic in D.
> It conflicts with AssignExpression which is identical in syntax
> and usage!
well, it's because I used the equality sign, languages like C#
use :,
I guess:
foo(x:10, 20)
would be better?
More information about the Digitalmars-d
mailing list