Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Mutable field update ignored in closure #7789
Original bug ID: 7789
Consider the following program:
In OCaml <= 4.05.0, it prints (correctly):
In OCaml 4.06.0 and 4.07.0+beta2 (at least), it prints (incorrectly):
Steps to reproduce
Compile the above program with ocamlc or ocamlopt, or enter it into the top-level.
The given code is a reduced form from a larger example:
Comment author: @nojb
The code for f in 4.06 is:
In 4.05 it is:
Somehow f is curried in 4.06 which leads to an early extraction of the value of the udata.n field in 4.06, while it is correctly delayed until f is fully applied in 4.05.