www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Feature Request: "self" keyword to indicate "the current function"

This would effectively give us anonymous recursion for comparatively little
effort.

Problems: "void test(typeof(self) foo, int bar);". To resolve this case
requires infinite recursion support in the type system, or a generic "this
type" type at the mangling level.

Or it could just be an error. :p On the other hand, if the above were made to
work, we could implement the Y combinator in D. Not that we'd need it at that
point. :p

 --downs
May 03 2008