delegate with optional parameters

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Apr 2 20:08:22 PDT 2017


On 04/02/2017 03:24 PM, Inquie wrote:

 >> Show a usage, someone certainly propose a pattern that does the job.
 >
 > int delegate() f;
 > void delegate(int) f;

That won't work because both of those are variables and variables don't 
have overloading.

 > These are effectively overload methods, but my guess is that D won't
 > support it like overloads.
 > e.g.,
 >
 > int f();
 > void f(int);

Yep, both 'f' are functions there.

I'm having difficulty understanding your actual need as well. :/ A 
guess: It is possible to determine delegate parameter list at compile 
time like std.concurrency.receive does.

Ali



More information about the Digitalmars-d-learn mailing list