the problem has to do with cycles
I'm kind of chatting on here about possible solutions :)
anyway I mean the obvious thing is to do the usual algorithm for detecting SCCs, I think
basically I think we would not cache anything that depended on a cycle until we reach the "head" of the cycle in the stack, and then we'd cache everything at once (as appropriate)
implementing this though is gonna' be a bit annoying
I'm also worrying a bit about the SLG solver in chalk-engine; want to be sure it doesn't fall into the same trap... I feel like it may.