It would be really nice to have an AST that was a tree with ~. This would have countless advantages, like the ast-fold could consume the AST and only allocate if it is actually creating a new node, and we'd generally not have the problems associated with Gc (the GC might be able to land!).
However, there are a few areas that are very tricky; mainly the AST map, which maps node_id to actual AST nodes of various types, the only safe way to do this with an ~ tree is with & references... which freezes the AST for the remainder of the program, so no transformations like constant evaluation, and no consuming of the AST by trans.
It would be really nice to have an AST that was a tree with
~. This would have countless advantages, like the ast-fold could consume the AST and only allocate if it is actually creating a new node, and we'd generally not have the problems associated withGc(the GC might be able to land!).However, there are a few areas that are very tricky; mainly the AST map, which maps
node_idto actual AST nodes of various types, the only safe way to do this with an~tree is with&references... which freezes the AST for the remainder of the program, so no transformations like constant evaluation, and no consuming of the AST by trans.