DIP 1030--Named Arguments--Community Review Round 1 Discussion

Arine arine123445128843 at gmail.com
Sun Feb 9 19:51:35 UTC 2020


On Sunday, 9 February 2020 at 19:45:20 UTC, Walter Bright wrote:
> On 2/8/2020 4:56 PM, Jon Degenhardt wrote:
>> That said, having parameter names automatically become part of 
>> a function's API is a meaningful downside. (Specifically, that 
>> a parameter name cannot be changed without risk of breaking 
>> existing callers.)
>
> Note that D already has "named parameters" for struct 
> initializers. That means, for example, that the names of the 
> struct field cannot be changed without breaking any initializer 
> relying on it.
>
> I've never heard a single comment about this, let alone any 
> complaint, nor any indication that anyone's code broke.

struct A {
    int foo;
}

struct A {
     int bar; // renamed from foo
     deprecated alias foo = bar;
};


False equivalency, you have many tools at your disposal to deal 
with this for structs.


Also found a bug.

A a = { foo: 10 }; // no deprecation warning, when foo is the 
deprecated alias


More information about the Digitalmars-d mailing list