On 12/20/2014 7:11 PM, Steven Schveighoffer wrote:
Wouldn't a tree own its nodes?
I've replied to this repeatedly. Think of a symbol table tree, in which symbols are looked up. References to found symbols are then inserted into the AST.
Building a language design that REQUIRES ownership of all references in an object would be cripplingly limited.
I find the idea of a tree checking its nodes to ensure it's properly sorted (or maybe properly balanced) cannot possibly be done without actually looking at its nodes. How do you propose one would check that invariant?
Not using invariant() to do it. The existence of invariant() with language support does not mean that there aren't other ways to do it, or that invariant() must be universally applicable to everything.
For an analogy, constructors don't solve every creation issue - sometimes a factory() method is more appropriate.
