Delegate returning itself

Jonathan Marler via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Dec 6 07:28:10 PST 2014


Is there a way to create a delegate that returns itself?

alias MyDelegate delegate() MyDelegate;
// OR
alias MyDelegate = MyDelegate delegate();

When I compile this I get:

Error: alias MyDelegate recursive alias declaration

The error makes sense but I still feel like there should be a way 
to create a delegate that returns itself.  Maybe there's 
something I haven't thought of.  Does anyone have an idea on how 
to do this?


More information about the Digitalmars-d-learn mailing list