2 ms·
Even if we implemented TCO, I doubt it would be idiomatic because destructors reduce the number of tail call positions so dramatically.
by pcwalton 14y ago
Even if we implemented TCO, I doubt it would be idiomatic because destructors reduce the number of tail call positions so dramatically.
- jacquesm 14y agoRight, because any destructor would break your ability to do TCO assuming that it runs before the tail call... So as soon as you use an object mechanism that will invoke a destructor at some point your ability to use TCO is gone. Interesting, isn't there a possible transformation where you would be able to move the constructor/destructor pairs out of the generated loop construct without breaking the function? After all a tail call is just a fancy go-to under the hood.