Delegate returning itself

Jonathan Marler via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 8 06:08:32 PST 2014


On Saturday, 6 December 2014 at 15:46:16 UTC, Adam D. Ruppe wrote:
> The problem is the recursive *alias* rather than the delegate. 
> Just don't use the alias name inside itself so like
>
> alias MyDelegate = void delegate() delegate();
>
> will work. The first void delegate() is the return value of the 
> MyDelegate type.

Yes I tried that as well.  It still doesn't solve the issue.  The 
delegate being returned doesn't return a delegate, it returns the 
"void" type.  You would need to write delegate() delegate() 
delegate() delegate() ...FOREVER.  I can't figure out a way to 
write this in the language even though the machine code it 
generates should be quite trivial.


More information about the Digitalmars-d-learn mailing list