Strange effect of Browse
Ole Edsberg
Ole.Edsberg at idi.ntnu.no
Sun Feb 1 16:24:57 CET 2004
Hi,
I have encountered some (to me) perplexing behaviour of the Oz emulator. I
am using version 1.2.5 on Debian (Sid).
Try to feed the following buffer:
%%%
declare
fun {Stat S1 Sn}
Stat1 Si in
case S1
of ident(_)|'='|tull|S2 then raise tull end
[] ident(X)|'='|S2 then V in
V = {Value S2 Si}
Stat1 = val_cr(ident(X) V)
end
%{Browse tull}
Sn = Si % Here we get tell failure if we browse
Stat1
end
fun {Value S1 Sn}
V in
V|Sn = S1
V
end
Tokens = [ident('X') '=' int(1)]
AST = {Stat Tokens nil}
{Browse AST}
%%%
The final Browse will display a sensible result in the browser.
Then uncomment the {Browse tull} call and feed the buffer again. Now we
get a tell failure at "Sn = Si".
%***************************** failure **************************
%**
%** Tell: val_cr(ident('X') int(1)) = nil
%**
%** Call Stack:
%** procedure 'Stat' in file "/home/edsberg/Problem.oz", line 3, column 0,
PC = 137398840
%**--------------------------------------------------------------
Apparently, Sn has now got a different value. I cannot understand how the
presence or absence of {Browse tull} would affect this.
The code above is the result of removing as much as possible from my
program while retaining the strange behaviour. Apparantly, both the call
to Value, the ident(_)|'='|tull|S2 case and the use of the intermediary
variable Si are necessary to keep the problem. The tell failure remains if
I replace the Browse with a Show, but not if I replace it with a skip.
Can someone explain what is happening?
Regards,
Ole Edsberg
More information about the mozart-users
mailing list