From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 11F4ABC84 for ; Mon, 18 Apr 2005 18:17:01 +0200 (CEST) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.207]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j3IGGxUG018929 for ; Mon, 18 Apr 2005 18:17:00 +0200 Received: by zproxy.gmail.com with SMTP id 34so36980nzf for ; Mon, 18 Apr 2005 09:16:59 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=GajIWJ0zJzaiYSPpdxxR5jKK+Jv93FiGLS/0sIrIn1t7CD7HwaitbZUijbqcFAMyz9qrU2X2tsOiuk5ycyQcPu4bf8NQr2wb7JiNMvh2BwtjcgRSa2GdzFQlI+RaZxrpSQA4YfNBHF1yMCF7Pm6ZxF1tTry6/PRgn8gwo6IQXt4= Received: by 10.36.59.9 with SMTP id h9mr385639nza; Mon, 18 Apr 2005 09:16:59 -0700 (PDT) Received: by 10.36.55.18 with HTTP; Mon, 18 Apr 2005 09:16:59 -0700 (PDT) Message-ID: <6b8a91420504180916b101439@mail.gmail.com> Date: Mon, 18 Apr 2005 18:16:59 +0200 From: Remi Vanicat Reply-To: Remi Vanicat To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] type of == In-Reply-To: <200504181227.07108.jon@ffconsultancy.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <42637B63.1070608@ifp.fr> <200504181227.07108.jon@ffconsultancy.com> X-Miltered: at nez-perce with ID 4263DD7C.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 christophe:01 bool:01 bool:01 semantics:01 val:01 foo:01 foo:01 10.:98 wrote:01 wrote:01 equality:01 equality:01 polymorphic:01 remi:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_BY_IP autolearn=disabled version=3.0.2 X-Spam-Level: On 4/18/05, Jon Harrop wrote: > On Monday 18 April 2005 10:18, Christophe DEHLINGER wrote: > > I was recently in a situation where I would have liked to be able to > > test physical equality on terms of possibly different types, but > > couldn't because of =3D=3D's 'a -> 'a -> bool type. > > Why isn't its type 'a -> 'b -> bool ? Is there more to the > > implementation of =3D=3D than a simple physical, asm-level equality tes= t ? > > Is it because of the semantics of =3D=3D ? If so, is a 'a -> 'b -> bool > > equivalent possible / already existing ? >=20 > If there were an "'a -> 'b -> bool" physical equality test, how could it = ever > return "true"? Well, when I wrote my Weak memo module (see http://aspellfr.free.fr/hweak/doc/Weak_memo.html), I add the need too compare two object having a different type (too know if they are actually the same or not). So I needed a egalyty having the type <..> -> <..> -> bool One could wrote one : # let eq x y =3D (x : < .. > :> < > ) =3D=3D (y : < .. > :> < >);; val eq : < .. > -> < .. > -> bool =3D But I don't know how to write it for polymorphic variant (without the Obj module) for example, and someone may want to do a similar weak memo on them (Notice that if one could write this, then one can do the same on structural equality, and I'm not sure that one want to use this on structural equality as I don't know what will appen if you try to compare `Foo 10 with `Foo (10.) or some nasty things like that)