caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Remi Vanicat <remi.vanicat@gmail.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] type of ==
Date: Mon, 18 Apr 2005 18:16:59 +0200	[thread overview]
Message-ID: <6b8a91420504180916b101439@mail.gmail.com> (raw)
In-Reply-To: <200504181227.07108.jon@ffconsultancy.com>

On 4/18/05, Jon Harrop <jon@ffconsultancy.com> 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 =='s 'a -> 'a -> bool type.
> > Why isn't its type 'a -> 'b -> bool ? Is there more to the
> > implementation of == than a simple physical, asm-level equality test ?
> > Is it because of the semantics of == ? If so, is a 'a -> 'b -> bool
> > equivalent possible / already existing ?
> 
> 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 = (x : < .. > :> < > ) == (y : < .. > :> < >);;
val eq : < .. > -> < .. > -> bool = <fun>

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)


  parent reply	other threads:[~2005-04-18 16:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-18  9:18 Christophe DEHLINGER
2005-04-18 11:27 ` [Caml-list] " Jon Harrop
2005-04-18 12:11   ` Andreas Rossberg
2005-04-18 13:10     ` Christophe DEHLINGER
2005-04-18 14:28     ` Jon Harrop
2005-04-19  7:12       ` [Caml-list] type of == - Bayesian Filter detected spam Christophe DEHLINGER
2005-04-18 16:16   ` Remi Vanicat [this message]
2008-01-05 16:41 Type_of? Dario Teixeira
2008-01-05 17:12 ` [Caml-list] Type_of? Jeremy Yallop
2008-01-05 17:43 ` Arnaud Spiwack

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=6b8a91420504180916b101439@mail.gmail.com \
    --to=remi.vanicat@gmail.com \
    --cc=caml-list@yquem.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).