%% dataflow variables revisited:
local X Y Z in
X = 5
Y = 6
Z = X+Y
{Browse [X Y Z]}
end
local X Y Z in
Z = X+Y % will block forever (X and Y are not bound, "+" suspends)
X = 5
Y = 6
{Browse [X Y Z]}
end
local X Y Z in
thread Z = X+Y end % will wait until parent thread assigns X and Y
X = 5
Y = 6
{Browse [X Y Z]}
end
local X Y Z in
thread Z = X+Y end % will wait forever for Y
X = 5
Z = 6
{Browse [X Y Z]}
end
local X Y Z in
thread Z = X+Y end % after Y is assigned 1, it resumes execution:
% compatible assignment "6 = 6"
X = 5
Z = 6
{Browse [X Y Z]}
Y = 1
end
local X Y Z in
thread Z = X+Y end % after Y is assigned 2, it resumes execution:
% incompatible assignment "6 = 7" displays failure
% but store assignments remain X=5 Z=6 Y=2
X = 5
Z = 6
{Browse [X Y Z]}
Y = 2
end
% failures halt execution of a composite statement, e.g.:
local X Y Z in
thread
Z = X+Y % after Y is assigned 2, it resumes execution:
% incompatible assignment "6 = 7" displays failure
{Browse Z} % Z is not displayed.
end
X = 5
Z = 6
{Browse [X Y Z]}
Y = 2
end
local X Y Z in
thread
Z = X+Y % after Y is assigned 1, it resumes execution:
% compatible assignment "6 = 6"
{Browse Z} % Z is displayed.
end
X = 5
Z = 6
{Browse [X Y Z]}
Y = 1
end
% cyclic memory
declare X
X = foo(X)
{Browse X}
% cells equality/inequality
declare C1 C2
C1 = {NewCell 5}
C2 = {NewCell 5}
{Browse C1==C2}
{Browse {Access C1}=={Access C2}}
% single-assignment store variables equality/inequality
declare X Y
X = 5
Y = 5
{Browse X==Y}
declare X Y
X = Y
{Browse X==Y}
Y = 5
{Browse X}
declare X Y
{Browse X==Y} % suspends
X=Y % resumes and displays true
declare X Y
{Browse X==Y} % suspends
X=5 % or this thread resumes and displays false
Y=6 % since 5 = 6 is incompatible