From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 21637BBAF for ; Mon, 10 Aug 2009 16:27:43 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhUEAJXLf0qACH+TgWdsb2JhbACaTgEBFiSmLoVkiE6EGAWBTGo X-IronPort-AV: E=Sophos;i="4.43,353,1246831200"; d="scan'208";a="44526064" Received: from server-nat-4.cs.umd.edu (HELO bacon.cs.umd.edu) ([128.8.127.147]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 10 Aug 2009 16:27:39 +0200 X-CSD-MailScanner-Watermark: 1250519209.05618@XRDIYtoofnAkS81zDUn2FA Received: from veruca.cs.umd.edu (veruca.cs.umd.edu [128.8.128.211]) (authenticated bits=0) by bacon.cs.umd.edu (8.13.1/8.14.1) with ESMTP id n7AEQlu5030558 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO); Mon, 10 Aug 2009 10:26:47 -0400 Subject: Re: [Caml-list] Re: ocaml sefault in bytecode: unanswered questions From: Elnatan Reisner To: Martin Jambon Cc: Caml Mailing List In-Reply-To: <4A80225A.3060606@ens-lyon.org> References: <000301ca184b$032b8cc0$0982a640$@chollet@free.fr> <000701ca184d$29507e90$7bf17bb0$@metastack.com> <001001ca18c7$37b22220$a7166660$@chollet@free.fr> <001501ca18cc$d59a61a0$80cf24e0$@metastack.com> <001201ca18e9$c4456810$4cd03830$@chollet@free.fr> <4A7ED53B.90607@frisch.fr> <32623A80-A2C3-4AE4-B9FA-3FC0888494BD@cs.umd.edu> <4A7F1EEF.2050301@frisch.fr> <1249910539.27080.10.camel@veruca.cs.umd.edu> <4A80225A.3060606@ens-lyon.org> Content-Type: text/plain Date: Mon, 10 Aug 2009 10:26:47 -0400 Message-Id: <1249914407.27080.31.camel@veruca.cs.umd.edu> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-41.el4_7.2) Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0 (bacon.cs.umd.edu [172.24.3.34]); Mon, 10 Aug 2009 10:26:48 -0400 (EDT) X-Spam: no; 0.00; ocaml:01 bytecode:01 0200,:01 0200,:01 frisch:01 bool:01 val:01 pervasives:01 bool:01 pervasives:01 2009:98 2009:98 terminates:01 wrote:01 wrote:01 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