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

Walter Bright newshound2 at digitalmars.com
Thu Feb 13 01:37:58 UTC 2020


On 2/8/2020 6:31 PM, Adam D. Ruppe wrote:
> I would kinda love user-defined warnings. pragma(msg) comes close sometimes but 
> there is no way to conditionally trigger it.

     static if (condition) pragma(msg, "Look, Ma!");

Or static assert().

> A reasonable thing for the compiler to do btw would be to call out when function 
> names change. Suppose you have:
> 
> foo(bar: 1, baz: 4)
> 
> and later you change the signature to
> 
> foo(int bar, int coolness)
> 
> the compiler could reasonably issue an error:
> 
> error: foo has no parameter named `baz`. Did you mean `coolness`?
> 
> based on process of elimination to suggest the names not yet specified to ease 
> transition.

Note that the compiler already uses a spell checker to look for close symbol 
matches.


More information about the Digitalmars-d mailing list