caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: William Lovas <wlovas@stwing.upenn.edu>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Strange physical equality behavior
Date: Tue, 11 Nov 2003 19:32:43 -0500	[thread overview]
Message-ID: <20031112003242.GA23476@force.stwing.upenn.edu> (raw)
In-Reply-To: <20031111164656.GA3708@davidb.org>

On Tue, Nov 11, 2003 at 08:46:56AM -0800, David Brown wrote:
> On Tue, Nov 11, 2003 at 01:48:22AM -0500, Oleg Trott wrote:
> > On Sunday 09 November 2003 08:33 pm, Jacques Garrigue wrote:
> > >  On mutable structures, [e1 == e2] is true if and only if
> > >    physical modification of [e1] also affects [e2].
> > 
> > By the way, either "mutable structures" or "physical modification" need
> > to be clarified, because if (int ref list) is "mutable" then the above
> > is wrong:
> 
> If you take structure to mean a single data type, rather than a more
> complicated data structure, then it is true.

Well, what do you mean by "a single data type", then?  Surely a record is a
single data type, but ...

    type r = { mutable a: int; mutable r: r }

    let rec r1 = { a = 5; r = r2 }
        and r2 = { a = 7; r = r1 }

Surely you wouldn't argue that this is an immutable data structure, either
-- it contains nothing *but* mutable fields!  And yet,

    r1.a <- 6

also "affects" r2, but r1 != r2.  (Admittedly, though, the ambiguity may
lie in the usage of the word "affects".)

*shrug* Maybe it's a bit contrived, but i would err on the side of caution
and say that the documentation should be made clearer.

William

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2003-11-12  0:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-09 18:34 Oleg Trott
2003-11-10  1:33 ` Jacques Garrigue
2003-11-10  2:25   ` Oleg Trott
2003-11-10  8:29     ` Jacques Garrigue
2003-11-10 18:41       ` Michal Moskal
2003-11-11  1:35         ` Jacques Garrigue
2003-11-11  6:48   ` Oleg Trott
2003-11-11 16:46     ` David Brown
2003-11-12  0:32       ` William Lovas [this message]
2003-11-11 17:08     ` brogoff

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=20031112003242.GA23476@force.stwing.upenn.edu \
    --to=wlovas@stwing.upenn.edu \
    --cc=caml-list@inria.fr \
    /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;
as well as URLs for NNTP newsgroup(s).