The current system allows a Var to be initially unset and to be set only once. A situation has been identified where two unset vars can bubble up and find themselves in a connect equation post-rewrite. In this scenario, the runtime is unable to evaluate the connect since no actionable steps can be taken until at least one of the variables is set, transforming it into a bind or a redex, or in the event that both variables are set.
Several strategies have been proposed to manage this situation:
Reinserting the Connect Equation: This involves placing the connect equation back into the net, allowing for re-evaluation when hopefully at least one of the vars is set. However, this method may be inefficient as it could repeatedly attempt to evaluate the connect.
Thread Waiting Strategy: Maintain a thread that waits on a condition for one of the two vars to be set, enabling it to proceed and convert the connect into a bind or a redex.
Back Pointer in Var Node: Modify the Var node to incorporate a back pointer that is initially unset. The runtime can set the back pointer from the left-hand var to point to the right-hand var and vice versa. Consequently, the thread that sets a cell in one of the vars, while evaluating a bind, can check the back pointer and directly introduce a bind or a redex since it has a reference to the other var. Despite being seemingly the most efficient solution, it introduces some complexity when managing vars in binds and connects and could potentially be a strategy to resolve issue #3.
This issue seeks to explore and evaluate these strategies, aiming to implement a solution that efficiently handles the case of unevaluated connect equations involving unset vars.
The current system allows a
Var
to be initially unset and to be set only once. A situation has been identified where two unset vars can bubble up and find themselves in a connect equation post-rewrite. In this scenario, the runtime is unable to evaluate the connect since no actionable steps can be taken until at least one of the variables is set, transforming it into a bind or a redex, or in the event that both variables are set.Several strategies have been proposed to manage this situation:
Reinserting the Connect Equation: This involves placing the connect equation back into the net, allowing for re-evaluation when hopefully at least one of the vars is set. However, this method may be inefficient as it could repeatedly attempt to evaluate the connect.
Thread Waiting Strategy: Maintain a thread that waits on a condition for one of the two vars to be set, enabling it to proceed and convert the connect into a bind or a redex.
Back Pointer in Var Node: Modify the Var node to incorporate a back pointer that is initially unset. The runtime can set the back pointer from the left-hand var to point to the right-hand var and vice versa. Consequently, the thread that sets a cell in one of the vars, while evaluating a bind, can check the back pointer and directly introduce a bind or a redex since it has a reference to the other var. Despite being seemingly the most efficient solution, it introduces some complexity when managing vars in binds and connects and could potentially be a strategy to resolve issue #3.
This issue seeks to explore and evaluate these strategies, aiming to implement a solution that efficiently handles the case of unevaluated connect equations involving unset vars.