pyret-lang
pyret-lang copied to clipboard
First mutable update binding is evaluated twice when type checking is turned on
Example:
var calls = 0
fun get() block:
calls := calls + 1
0
end
data A:
a(ref x :: Number)
end
a(1)!{ x: get() }
print("Total calls: " + to-string(calls))
When the type checker is turned off, this will print Total calls: 1
. If the type checker is turned on however, it will print Total calls: 2
. This only happens with the first binding in a mutable update (subsequent bindings are only evaluated once), and does not happen with object extends.