On 10/14/2012 12:19 PM, Benjamin Thaut wrote:
Because you are now no longer able to do stuff like this: void log(...) { auto t = _arguments[0]; while(some condition) { t = t.next(); } } To be actually able to use TypeInfo.next you will now need the ConstRef (hack) from phobos. Afaik there is no such thing in druntime which makes working with TypeInfo.next within druntime a real pita.
That's the general problem of non-rebindable const references which is a real pita. There has been a pull request to implement it (https://github.com/D-Programming-Language/dmd/pull/3) but unfortunately it never made it into the compiler.
Any suggestions?
You could create a recursive function hoping for tail-recursion-optimization and inlining:
void log(...) { static const(TypeInfo) drillInto(const(TypeInfo) t) { if(some condition) return drillInto(t.next()); return t; } auto t = drillInto(_arguments[0]); }