Named Parameters (Was: A nice way to step into 2012)

Jonathan M Davis jmdavisProg at gmx.com
Thu Dec 29 13:59:46 PST 2011


On Thursday, December 29, 2011 18:49:51 so wrote:
> When you change a parameter name, you change interfaces file and
> documentation.
> Your user will recompile/reread regardless, because you came up with a new
> version.
> Now with NP those that "want to bother" will edit their codes, he asked
> for it.
> 
> If you say someone will be forced to do that i have no argument against
> that, you are right.

Recompilation is one thing. Having to change your code is another. Sure, if a 
file gets changed, when you recompile, any code importing that module will have 
to be rebuilt, but it doesn't have to be changed. With named arguments, if a 
parameter change were made, youe'd have to go and change any code which used 
it as a named argument - just like if you rename a function, you have to 
change any code which calls that function even if that function does exactly 
the same thing that it did before.

Introducing named arguments makes a function's parameters part of the API and 
introduces yet another point where code breakage can occur due to code 
changes. And that is a _very_ negative aspect of named arguments IMHO.

- Jonathan M Davis


More information about the Digitalmars-d mailing list