OK, I didn't actually read the "I give up on doing this in Rust" section very carefully.
The article capitulates:
> last time I asked how to do that in my company’s Slack channel, the responses I received were something like “don’t” and “why would you do that?” and “someone please call security.” It should not have been a surprise, as an AST is basically a linked list with extra steps, and Rust hates linked lists.
If I didn't tell myself "go find a good solution", I might have not found someone suggesting "Just use a bump allocator and make your nodes live until one exact, shared lifetime."
The article does agree in principle with this solution:
> In my experience, it’s quite easy to do away with the ceremony of making each node hold a reference count altogether, and instead decide on a more disciplined approach to ownership.
I think this is one of those examples where you get a principled, elegant and safe solution.
You just gotta find it first.
But here it is.
(Also, I read about it on a forum when searching for a better solution than box_patterns.)
The article capitulates:
> last time I asked how to do that in my company’s Slack channel, the responses I received were something like “don’t” and “why would you do that?” and “someone please call security.” It should not have been a surprise, as an AST is basically a linked list with extra steps, and Rust hates linked lists.
If I didn't tell myself "go find a good solution", I might have not found someone suggesting "Just use a bump allocator and make your nodes live until one exact, shared lifetime."
The article does agree in principle with this solution:
> In my experience, it’s quite easy to do away with the ceremony of making each node hold a reference count altogether, and instead decide on a more disciplined approach to ownership.
I think this is one of those examples where you get a principled, elegant and safe solution.
You just gotta find it first.
But here it is.
(Also, I read about it on a forum when searching for a better solution than box_patterns.)