When the compilation semantics for the words i, j, leave, unloop are performed, at least one do-sys must be present on the control-flow stack (and two do-sys in the case of j).
But currently a system cannot check this fact and cannot throw an exception if these words are used not within do...loop, because the control-flow stack diagram is not specified for compilation semantics. A system may only check in run-time if loop-sys is present on the top of the return stack and throw an exception if not — since loop-sys is specified in the stack diagrams.
We should specify compilation semantics for these words, with control-flow stack diagrams like: ( C: do-sys i*x -- do-sys i*x ), or ( C: do-sys2 i*x do-sys1 j*x -- do-sys2 i*x do-sys1 j*x ) for the word j.
It will allow a system to formally check do-sys at compile-time and throw an exception if these words are used incorrectly in compile-time (according to 3.1, which says: "An ambiguous condition exists if an incorrectly typed data object is encountered").
When the compilation semantics for the words
i
,j
,leave
,unloop
are performed, at least one do-sys must be present on the control-flow stack (and two do-sys in the case ofj
).But currently a system cannot check this fact and cannot throw an exception if these words are used not within do...loop, because the control-flow stack diagram is not specified for compilation semantics. A system may only check in run-time if loop-sys is present on the top of the return stack and throw an exception if not — since loop-sys is specified in the stack diagrams.
We should specify compilation semantics for these words, with control-flow stack diagrams like:
( C: do-sys i*x -- do-sys i*x )
, or( C: do-sys2 i*x do-sys1 j*x -- do-sys2 i*x do-sys1 j*x )
for the wordj
.It will allow a system to formally check do-sys at compile-time and throw an exception if these words are used incorrectly in compile-time (according to 3.1, which says: "An ambiguous condition exists if an incorrectly typed data object is encountered").
See also
DO ... LOOP
in the high level — viaBEGIN
...UNTIL