%% 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 % resumes and displays false
Y=6 % since 5 = 6 is incompatible
% on if semantics with non-boolean values:
if 0 then {Browse 1} else {Browse 2} end
% on case semantics on non-record value: goes to else clause
case 5 of H|T then {Browse 1} else {Browse 2} end
local I = fun {$ X} X end in
case I of H|T then {Browse 1} else {Browse 2} end
end
% no pattern matching on feature names:
local R=rec(f:v) in
case R of rec(X:Y) then {Browse[X Y]} else {Browse false} end
end
% though that would be ambiguous:
local R=rec(f1:v f2:v) in
case R of rec(X:v Y:v) then {Browse[X Y]} else {Browse false} end
end