Open mimopotato opened 1 month ago
maybe funcml-core could determine this behavior at the loading phase, before calling mutations.
# fake logic to explain
read_file
| parse_file
| analyze_circular_recursivity
| call_recursivity!
otherwise, each mutation call should pass its current object as a call parameter:
object.mutate(mutations, self)
class Object
def mutate(mutations = {}, calling_object)
# here we should check if the calling_object is also
# part of the current mutation context.
end
end
it would require all #mutate method to implement a logic and doesn't looks like a good abstraction.
Since this behavior can be introduced using simple data-structure, I don't think it should be analyzed on funcml-cli or Karist side.
Leads to stack overflow:
To avoid this behavior, a state management must be implemented, taking care of:
Let's keep elegant in the solution.
An exception should be raise when this behavior is encountered, preferably at the first occurence: