Is there a way for a function to return itself in D?

BCS ao at
Tue Oct 14 12:25:41 PDT 2008

Reply to Simen,

> Like the subject says, I wonder if it's possible for a function to
> return
> itself.
> No matter how I think of this, I end up with an endless recursive
> function
> declaration. Creating a functor that does this is simple, so why not a
> function?

struct Fwrap(T...)
     Fwrap!(T) function(T) inner;
     Fwrap!(T) opCall(T t){ return inner(t); }  //optional

More information about the Digitalmars-d-learn mailing list