SolPrologV2
SolPrologV2 copied to clipboard
Storing substitutions in memory
The current engine assumes that Substitution.Info is in storage but this means that we need to clear the substitutions after every call to Prolog.query(). I think it would be better to store substitutions in memory because we don't really need to persist them between contract calls.
Another disadvantage of having them in storage is that functions that would not otherwise modify contract state cannot be view or pure.
One way of potentially implementing this is to implement a RB tree data structure and use it in memory.
That would be a good idea for a nice, reusable library if we had templates in Solidity...