Function pointers/delegates default args were stealth removed?

Walter Bright newshound2 at digitalmars.com
Mon Aug 27 13:47:13 PDT 2012


On 8/27/2012 5:38 AM, Manu wrote:
> I don't really care so much HOW it works, only that it does. I think 99% of my
> cases would be addressed by the def args living in the variable declaration.

Can you please post a canonical 99% use case that you use? I cannot suggest an 
alternative otherwise. I need to understand what coding problem you have been 
solving with default args.

For example, the basic use case of default args is just a shorthand for doing 
function overloads:

     int foo(int a = 5) { ... }

becomes:

     int foo(int a) { ... }
     int foo() { return foo(5); }

Many use cases involving templates can be resolved by using alias template 
parameters.

But I don't know what your use cases are.


More information about the Digitalmars-d mailing list