If the interpreter panics or encounters an error after mutating part of the Context but still needs to complete more mutations, this may leave the Context in an inconsistent state. Instead of mutating as I go, I can compute what Concepts need to be mutated and describe the changes as a Delta type. The execute method can use the Delta to mutate the Context all in one place.
Context methods other than execute with a type signature like
This will allow the codebase to be a lot more functional and therefore easier to reason about and spread across threads in the future. If I leave this until the future, this will require a lot more restructuring.
If the interpreter panics or encounters an error after mutating part of the
Context
but still needs to complete more mutations, this may leave theContext
in an inconsistent state. Instead of mutating as I go, I can compute whatConcept
s need to be mutated and describe the changes as aDelta
type. Theexecute
method can use theDelta
to mutate theContext
all in one place.Context
methods other thanexecute
with a type signature likecan be restructured to
This will allow the codebase to be a lot more functional and therefore easier to reason about and spread across threads in the future. If I leave this until the future, this will require a lot more restructuring.