What to do about default function arguments

Daniel Murphy yebblies at nospamgmail.com
Thu Apr 26 09:54:07 PDT 2012


"Walter Bright" <newshound2 at digitalmars.com> wrote in message 
news:jnagar$2d8k$1 at digitalmars.com...
>A subtle but nasty problem - are default arguments part of the type, or 
>part of the declaration?
>
>    See http://d.puremagic.com/issues/show_bug.cgi?id=3866
>
> Currently, they are both, which leads to the nasty behavior in the bug 
> report.
>
> The problem centers around name mangling. If two types mangle the same, 
> then they are the same type. But default arguments are not part of the 
> mangled string. Hence the schizophrenic behavior.
>
> But if we make default arguments solely a part of the function 
> declaration, then function pointers (and delegates) cannot have default 
> arguments. (And maybe this isn't a bad thing?)

>From what I remember, function pointer parameter names have similar 
problems.  It never made any sense to me to have default parameters or 
parameter names as part of the type. 




More information about the Digitalmars-d mailing list