The While and DoWhile definitions contain to regions internally;
- A loop body with types
*state -> *state
- A
condition statement with types *state -> bool that decides when to stop the evaluation.
This is problematic when the state is linear; calling the condition forces us to discard the values.
The straightforward solution to this is to change the condition type to *state -> bool, *state.
For an alternative definition consider MLIR's scf.while. There we are able to use different types for the inputs and outputs of the loops.
That corresponds roughly to a jeff While where the regions have type:
while: *in_state -> *out_state
condition: *in_state -> bool, *out_state
body: *out_state -> *in_state
Are we happy with the single-state?
The
WhileandDoWhiledefinitions contain to regions internally;*state -> *stateconditionstatement with types*state -> boolthat decides when to stop the evaluation.This is problematic when the state is linear; calling the condition forces us to discard the values.
The straightforward solution to this is to change the
conditiontype to*state -> bool, *state.For an alternative definition consider MLIR's
scf.while. There we are able to use different types for the inputs and outputs of the loops.That corresponds roughly to a jeff
Whilewhere the regions have type:while: *in_state -> *out_statecondition: *in_state -> bool, *out_statebody: *out_state -> *in_stateAre we happy with the single-state?