Default argument values

bearophile bearophileHUGS at lycos.com
Thu May 20 17:23:57 PDT 2010


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

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).

Bye,
bearophile


More information about the Digitalmars-d mailing list