Discussion Thread: DIP 1030--Named Arguments--Final Review

Walter Bright newshound2 at digitalmars.com
Thu May 14 05:57:15 UTC 2020


On 5/13/2020 7:00 AM, Steven Schveighoffer wrote:
> As was pointed out in the last review -- if you have structs with public member 
> fields and you changed those names, the breakage would be more severe than just 
> a broken initializer call:
> 
> auto s = S(1, 2, 3);
> 
> writeln(s.foo); // Error, no member foo, did you mean Foo?

I don't know about "more severe". It would just give an error that a matching 
function was not found, and would pretty-print the list of candidate functions.

Besides, if you really don't want your users to use the parameter names,

     int foo(int _dkfjjiufheuehgthu, long _yer_mother_was_a_hamster, double 
_I_did_not_read_the_documentation);

and I bet they'll get the message.


More information about the Digitalmars-d mailing list