SolPrologV2 icon indicating copy to clipboard operation
SolPrologV2 copied to clipboard

Storing substitutions in memory

Open cameel opened this issue 5 years ago • 2 comments

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.

cameel avatar Aug 16 '20 15:08 cameel

One way of potentially implementing this is to implement a RB tree data structure and use it in memory.

leonardoalt avatar Aug 19 '20 13:08 leonardoalt

That would be a good idea for a nice, reusable library if we had templates in Solidity...

cameel avatar Aug 19 '20 14:08 cameel