caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Elnatan Reisner <elnatan@cs.umd.edu>
To: Martin Jambon <martin.jambon@ens-lyon.org>
Cc: Caml Mailing List <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Re: ocaml sefault in bytecode: unanswered questions
Date: Mon, 10 Aug 2009 10:26:47 -0400	[thread overview]
Message-ID: <1249914407.27080.31.camel@veruca.cs.umd.edu> (raw)
In-Reply-To: <4A80225A.3060606@ens-lyon.org>

On Mon, 2009-08-10 at 15:36 +0200, Martin Jambon wrote:
> Elnatan Reisner wrote:
> > On Sun, 2009-08-09 at 21:09 +0200, Alain Frisch wrote:
> >> Note that (=) sometimes terminates for cylic values.
> >>
> >> # type t = A of t | B of t;;
> >> type t = A of t | B of t
> >> # (let rec x = A x in x) = (let rec x = B x in x);;
> >> - : bool = false
> > 
> > Again, thanks for pointing this out. But can (=) ever evaluate to true
> > on cyclic structures?
> 
> Yes:
> 
> let rec x = `A x;;
> let o = object val x = x end;;
> o = o;;
> 
> -> true

Okay, give me one more try: Can (=) evaluate to true on cyclic
structures that are not objects? (My understanding is that objects are
compared---by both Pervasives.compare and by (=)---using only their
object ids, so [obj1 = obj2] is always just an comparison of two ints,
regardless of the contents of the objects. Is this correct?)

Also, I just tested out (>=), which the documentation says 'does not
terminate on cyclic structures':
# (let rec x = `A x in x) >= (let rec x = `B x in x);;
- : bool = false
So maybe my question went the wrong way: apparently the documentation of
(>=) should say 'may not terminate'.

Also, if I may, let me add two additional questions:
- Do (=), (<>), (<), (>), (<=), and (>=) all terminate on exactly the
same operands?
- Does Pervasives.compare terminate strictly more often, or are there
cases when the comparisons terminate but [compare x y] does not?

-Elnatan


  reply	other threads:[~2009-08-10 14:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-08 17:09 ivan chollet
2009-08-08 17:24 ` [Caml-list] " David Allsopp
2009-08-09  7:58   ` ivan chollet
2009-08-09 10:16     ` Michel Mauny
     [not found]     ` <001501ca18cc$d59a61a0$80cf24e0$@metastack.com>
2009-08-09 12:06       ` ivan chollet
2009-08-09 13:20         ` David Allsopp
2009-08-09 13:55         ` Alain Frisch
2009-08-09 14:13           ` ivan chollet
2009-08-09 18:56           ` Elnatan Reisner
2009-08-09 19:09             ` Alain Frisch
2009-08-10 13:22               ` Elnatan Reisner
2009-08-10 13:36                 ` Martin Jambon
2009-08-10 14:26                   ` Elnatan Reisner [this message]
2009-08-09 16:14     ` Goswin von Brederlow
2009-08-10  4:14       ` ivan chollet

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=1249914407.27080.31.camel@veruca.cs.umd.edu \
    --to=elnatan@cs.umd.edu \
    --cc=caml-list@yquem.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;
as well as URLs for NNTP newsgroup(s).