Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: William Lovas <wlovas@stwing.org>
To: "O'Caml Mailing List" <caml-list@inria.fr>
Subject: Re: [Caml-list] Type abstraction and (polymorphic) equality
Date: Wed, 29 Jun 2005 13:33:57 -0400	[thread overview]
Message-ID: <20050629173356.GB4090@force.stwing.upenn.edu> (raw)
In-Reply-To: <20050629.023111.15476874.debian00@tiscali.be>

On Wed, Jun 29, 2005 at 02:31:11AM +0200, Christophe TROESTLER wrote:
> Let me start with a little story that happened to me recently.
> [...]
> 
> The problem was that the attached information (an additional field in
> a record) was a cyclic data structure.  From there on, all equality
> tests became deadly! (I would have preferred to have the exception
> Invalid_argument "equal: abstract value".)  What made matters worse is
> that the compiler could not help me to find the locations of such
> problems -- which can be hidden e.g. in List.mem.  Not a nice job to
> do...

A harrowing and tragic tale indeed!  While not really a solution to your
problems, you *can* obtain the "abstract value" exception behavior with a
little trick; Jacques Garrigue posted about it to the list a couple of
months ago:

    http://caml.inria.fr/pub/ml-archives/caml-list/2005/04/66b52e5c944a3bd4c45e8b68c450461a.en.html

I say it's no solution because (a) it doesn't keep you from having to write
your own equality predicate with a different name, and (b) the compiler
gives you no static warnings about invalid uses -- might as well program in
Scheme! ;)

cheers,
William


  parent reply	other threads:[~2005-06-29 17:34 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-29  0:31 Christophe TROESTLER
2005-06-29  9:12 ` [Caml-list] " Jon Harrop
2005-06-29 10:06   ` Andreas Rossberg
2005-06-29 13:32   ` Christophe TROESTLER
2005-06-29 23:39     ` brogoff
2005-06-30  7:46       ` Christophe Raffalli
2005-06-29 20:27   ` Christophe TROESTLER
2005-06-29 20:37   ` John Skaller
2005-06-30  9:53     ` Andreas Rossberg
2005-06-30 17:08       ` brogoff
2005-06-30 17:22         ` Andreas Rossberg
2005-06-30 19:56       ` John Skaller
2005-07-01 12:49         ` Andreas Rossberg
2005-06-29  9:45 ` Jean-Christophe Filliatre
2005-06-29 17:33 ` William Lovas [this message]
2005-06-29 18:08 ` sejourne_kevin
2005-06-30  9:51   ` Andreas Rossberg
2005-06-30 19:54     ` John Skaller
2005-06-30 22:24       ` Alain Frisch
2005-06-30 12:19 ` Alain Frisch
2005-06-30 12:32   ` padiolea
2005-06-30 12:57     ` Alain Frisch

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=20050629173356.GB4090@force.stwing.upenn.edu \
    --to=wlovas@stwing.org \
    --cc=caml-list@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