From: Nicolas Pouillard <nicolas.pouillard@gmail.com>
To: Martin Jambon <martin.jambon@ens-lyon.org>
Cc: OCaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] How to mutate immutable record fields?
Date: Sat, 15 Oct 2011 11:07:03 +0200 [thread overview]
Message-ID: <CALNLtiLbRzmNQMBtfBCTKjBErvkinOWKCe0m_sQX=U5UANnS_g@mail.gmail.com> (raw)
In-Reply-To: <4E993FE5.7080409@ens-lyon.org>
On Sat, Oct 15, 2011 at 10:10 AM, Martin Jambon
<martin.jambon@ens-lyon.org> 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
next prev parent reply other threads:[~2011-10-15 9:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-15 8:10 Martin Jambon
2011-10-15 9:07 ` Nicolas Pouillard [this message]
2011-10-15 9:13 ` Jeremy Yallop
2011-10-15 9:15 ` Gabriel Scherer
2011-10-18 21:45 ` Martin Jambon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CALNLtiLbRzmNQMBtfBCTKjBErvkinOWKCe0m_sQX=U5UANnS_g@mail.gmail.com' \
--to=nicolas.pouillard@gmail.com \
--cc=caml-list@inria.fr \
--cc=martin.jambon@ens-lyon.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox