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.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 9FA10BBAF for ; Sun, 9 Aug 2009 21:09:48 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoYCAHq7fkrUGyoFkWdsb2JhbACaSwEBAQEJCwoHEwOxJYQYBYInD4dY X-IronPort-AV: E=Sophos;i="4.43,349,1246831200"; d="scan'208";a="30960481" Received: from smtp5-g21.free.fr ([212.27.42.5]) by mail2-smtp-roc.national.inria.fr with ESMTP; 09 Aug 2009 21:09:47 +0200 Received: from smtp5-g21.free.fr (localhost [127.0.0.1]) by smtp5-g21.free.fr (Postfix) with ESMTP id B905BD480D9; Sun, 9 Aug 2009 21:09:42 +0200 (CEST) Received: from [82.229.183.156] (rke75-3-82-229-183-156.fbx.proxad.net [82.229.183.156]) by smtp5-g21.free.fr (Postfix) with ESMTP id C32B2D480E3; Sun, 9 Aug 2009 21:09:39 +0200 (CEST) Message-ID: <4A7F1EEF.2050301@frisch.fr> Date: Sun, 09 Aug 2009 21:09:35 +0200 From: Alain Frisch User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3pre) Gecko/20090808 Shredder/3.0b4pre MIME-Version: 1.0 To: Elnatan Reisner Cc: Caml Mailing List Subject: Re: [Caml-list] Re: ocaml sefault in bytecode: unanswered questions 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> In-Reply-To: <32623A80-A2C3-4AE4-B9FA-3FC0888494BD@cs.umd.edu> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; frisch:01 frisch:01 ocaml:01 bytecode:01 mutable:01 symmetric:01 toplevel:01 arrays:01 recursive:01 ocaml:01 bool:01 nans:01 2009:98 equality:01 terminates:01 On 8/9/2009 8:56 PM, Elnatan Reisner wrote: > My other issue is that the description of (==) for mutable structures > doesn't specify that it is symmetric; reading the documentation > literally only implies that e1 is a substructure of e2. Even just adding > 'and vice versa' might clean this up: > |e1 == e2| is true if and only if physical modification of |e1| also > affects |e2 and vice versa| It depends on what 'physical modification' and 'affect' mean. Clearly, the documentation means toplevel modifications of the values (i.e. modifying fields for record values, or elements for arrays or strings). If one includes deep modifications, then your extended criterion does not work either (think about two mutually recursive records). > In terms of 'may not' versus 'does not' terminate, I just noticed that > the current documentation for (=) says 'may not terminate' while the > documentation for (>=) says 'does not terminate'. However, the example > cited in the link above: > type t = { a : t };; > let rec x = { a = x } in x = x > doesn't terminate in OCaml 3.11. This seems to be about as simple a > cyclic structure as there is, so shouldn't (=)'s documentation say > 'Equality between cyclic structures does not terminate.'? 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 > And is there any reason, aside from NaN values, that (=) does *not* use > physical equality as a shortcut? I think a custom comparison function for custom blocks can also specify that a value is not equal to itself. > In any case, if I have a data structure which I know does not contain > any NaNs (for example, maybe it doesn't contain any floats whatsoever), > is there ever a reason I should prefer (=) to (compare x y = 0)? No, I don't see any reason. -- Alain