Default argument values

Alex Makhotin alex at bitprox.com
Fri May 21 02:27:14 PDT 2010


bearophile wrote:
> Near the end it says:
> 
>> If we change the value of the optional argument from 0 to 1, we have to recompile all calling code for the calling code to get the updated value! For folks shipping assemblies for a living, this means that optional argument values don't version well, as callers have to recompile.  When I used to work for a company whose product included a DLL, we avoided optional method arguments for just this reason. It's not a reason not to use optional arguments, but it's important to understand how they work so that you don't run into headaches later.<

Very bad idea, I would say, to change the interface after it was already 
published. Not surprising the new rules break the caller.

> I presume this part of the D design will not change

And again my point here(not only on this topic specifically) is that the 
compiler should be programmer's friend, not the opposite. It must be 
based on the strict specification where such possible problems 
documented in detail. Ideal solution, IMHO, such inconsistencies must be 
restricted or forbidden until documented properly. The compiler should 
give warnings whenever possible and as many as needed to help detect bugs.
 From my point of view, a good designed language should not, in 
principle, allow undefined, leading to bugs behavior. All possible 
issues should be predicted and treated adequately before they even emerge.
As I look at D, I do not experience such attitude.



-- 
Alex Makhotin,
the founder of BITPROX,
http://bitprox.com


More information about the Digitalmars-d mailing list