Default argument values

Walter Bright newshound1 at digitalmars.com
Thu May 20 18:41:59 PDT 2010


bearophile wrote:
> Walter Bright:
> 
>> I don't see how it could be called a dirty hack.
> 
> Because it's untidy, in the source code it looks like the information of the
> default value is located in the function definition, while in truth it is
> stored elsewhere. This can be more efficient, but it is not tidy, this
> abstraction can leak a lot, you can see it here: 
> http://d.puremagic.com/issues/show_bug.cgi?id=4028 Maybe this too is related:
>  http://d.puremagic.com/issues/show_bug.cgi?id=3430

These are both bugs, and not a design fault in having default arguments.


> I presume this part of the D design will not change (even if a solution for
> those two bugs need to be found), but a language designer must be able to
> tell apart what is done for efficiency (putting the information of the
> default arguments at the calling point) and what's the right and tidy thing
> to do (putting this information somehow connected to the function itself).

I don't agree that your proposal is necessarily right or tidy. D is a compile 
time language, and it would be strange to expect it to behave otherwise.

I also don't see recompilation as a problem, as D compiles at an incredible speed.


More information about the Digitalmars-d mailing list