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

Adam D. Ruppe destructionator at gmail.com
Sun Feb 9 02:31:35 UTC 2020


On Sunday, 9 February 2020 at 02:15:36 UTC, Jon Degenhardt wrote:
> Or perhaps a way to discourage it, for example, a compile-time 
> warning about no-backward compatibility for parameter names.

I would kinda love user-defined warnings. pragma(msg) comes close 
sometimes but there is no way to conditionally trigger it. (You 
can sort of conditionally disable via `version()` though.)

Of course, you could just name your parameters 
`_randomNameYouReallyDontWantToUse_like_seriously_dont_rely_on_this_name_lol` :P

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.


More information about the Digitalmars-d mailing list