Fixed bug with mutable closures in interpret (not really --- up to closure recursion)

This commit is contained in:
Dmitry Boulytchev 2019-10-17 15:30:50 +03:00
parent 1d28f4af6b
commit dad4c35a80
5 changed files with 31 additions and 7 deletions

19
regression/test068.expr Normal file
View file

@ -0,0 +1,19 @@
fun lazy (f) {
local flag = 0, value = 0;
return fun () {
if flag
then return value
else
value := f ();
flag := 1;
return value
fi
}
}
local l = lazy (fun () {write (1); return 800});
local x = read ();
write (l ());
write (l ())