Open HighDiceRoller opened 2 months ago
This could turn into a more comprehensive rework of MultisetExpression
. Issues to look at:
next_state
etc. to the subexpressions, which makes writing new expression types kind of annoying. Possible alternatives include:
next_state
call an abstract function that only handles the current node and implement the subexpression handling in the base class. Though this would introduce an extra function call per node.next_state
only consider local information anyways, because the generation and the evaluation will probably use it in different ways. The generator needs to produce a cacheable unit, which is currently an instance itself, and probably should remain so. On the other hand, the evaluator side uses an separate state object rather than an instance itself.
Basically the idea is that expressions outside of
multiset_function
would attach to generators, and expressions inside would attach to evaluators. This is mostly driven by cache reusability.Here the "cut point" for unbinding would be at the first non-fully-bound expression node, rather than immediately at the generator.