This seems like it could potentially simplify the language a bit – having both ref and var types is a bit strange, and using these to simulate const-ness never felt quite right either.
In my opinion, nim has a problem with the composability of its language features. For instance, async functions use Futures but parallel code uses FlowVars: they’re modeling the same concept but are completely incompatible. ref and var feel like a similar situation – hopefully this consolidation will help!
Does the tree destructor work? I don’t really know nim, but it looks like it is still recursive. The root goes onto the stack to destroy, eventually gets called, putting left and right on the stack. But once the stack hits 100, it immediately calls the destroy function. Which destroys left and right, immediately. And so on, all the way down.