Closed viperscape closed 7 years ago
Instead of an explicit back target, when the node ends it could just head back to the previous node-- perhaps at the index of the source it was called from; this would be much more like Functions in other languages.
parent
next:now child
# child ends, parent continues here
;
child
# heads back to parent
;
To do this, we'll need to track not only what nodes we're visiting, but also their source position index. That way when we visit a previously visited node, we start from index 0 but when we backtrack down the stack of nodes we can also pick up where we left off. This would mean preserving nodes recursively.
Need to also implement a Next:restart and optional target; resetting the position index of the node.
Since we automatically revert back to previous node, a Next:halt or clear option should be available to immediately end all evaluation
marked complete
A convenient target for next could be Back. Right now in lichen you can only move forward in nodes; but being able to back up a node would be great.
This might be complex if a child node continues on to another node, perhaps a stack of parent nodes could be stored for backtracking.