On Sat, Oct 15, 2011 at 10:10 AM, Martin Jambon <[email protected]> wrote: > Dear fellow OCamlers,
My guess is that set_field is not to blame here. The ``trouble'' is that ocamlopt optimizes the immutable read access to the supposed immutable foo field, and reads it before the call to set_field. We can see this in sevral ways: first making it a mutable field gives the expected behavior, second making the projection harder to optimize by turning t.foo into ((fun x -> x) t).foo has also the correct behavior. Other simple variations reveal the same behavior. Obj.regards, -- Nicolas Pouillard http://nicolaspouillard.fr -- Caml-list mailing list. Subscription management and archives: https://sympa-roc.inria.fr/wws/info/caml-list Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
