4 ms·
Well you can see the one in the article about sharing the computation from the two branches - there's no way to represent that in an AST, for the very reason th
by chrisseaton 6y ago
Well you can see the one in the article about sharing the computation from the two branches - there's no way to represent that in an AST, for the very reason that it's a tree - there can only be one user of a node in an AST, but in a graph, multiple nodes can use it.
You could introduce some kind of hidden local variables and assign to those, but then you're kind of building a graph in an AST, and might as well use a graph, and those variables are harder to understand for other optimisations.
(Note that these aren't 'my' optimisations, I'm just writing about them.)