I've actually been making fairly extensive use of function/delegate default args. I was pleasantly surprised when I realised it was possible.<div>Funnily enough, It's one of those things that I just expected should work (as I find most things I just expect should work do in fact tend to work in D), so it seems it was intuitive too at some level.</div>
<div><br></div><div>It would be a shame to see it go, but I wouldn't say it's critical, just very handy. In my case, used in shared interface bindings. Occurs more often than not in some interfaces.<br><br><div class="gmail_quote">
On 26 April 2012 07:00, Jonathan M Davis <span dir="ltr"><<a href="mailto:jmdavisProg@gmx.com">jmdavisProg@gmx.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Wednesday, April 25, 2012 20:44:07 Walter Bright wrote:<br>
> A subtle but nasty problem - are default arguments part of the type, or part<br>
> of the declaration?<br>
><br>
>     See <a href="http://d.puremagic.com/issues/show_bug.cgi?id=3866" target="_blank">http://d.puremagic.com/issues/show_bug.cgi?id=3866</a><br>
><br>
> Currently, they are both, which leads to the nasty behavior in the bug<br>
> report.<br>
><br>
> The problem centers around name mangling. If two types mangle the same, then<br>
> they are the same type. But default arguments are not part of the mangled<br>
> string. Hence the schizophrenic behavior.<br>
><br>
> But if we make default arguments solely a part of the function declaration,<br>
> then function pointers (and delegates) cannot have default arguments. (And<br>
> maybe this isn't a bad thing?)<br>
<br>
</div></div>Can function pointers have default arguments in C? Honestly, it strikes me as<br>
rather bizarre for them to have default arguments. I really don't think that<br>
they buy you much.<br>
<br>
If you use the function or delegate immediately after declaring it (as is<br>
typically the case when they're nested), then you could have just just put the<br>
default argument in the function itself and not have it as a parameter. And if<br>
you're holding on to a function or delegate long term, you're almost certainly<br>
going to be using it generically, in which case I wouldn't expect a default<br>
argument to make sense there often either.<br>
<br>
I'd vote to just disallow default arguments for function pointers and<br>
delegates.<br>
<span class="HOEnZb"><font color="#888888"><br>
- Jonathan M Davis<br>
</font></span></blockquote></div><br></div>