caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: padiolea@irisa.fr
To: "Alain Frisch" <Alain.Frisch@inria.fr>
Cc: "Christophe TROESTLER" <debian00@tiscali.be>,
	"O'Caml Mailing List" <caml-list@inria.fr>
Subject: Re: [Caml-list] Type abstraction and (polymorphic) equality
Date: Thu, 30 Jun 2005 14:32:21 +0200 (CEST)	[thread overview]
Message-ID: <42164.131.254.50.45.1120134741.squirrel@mail.irisa.fr> (raw)
In-Reply-To: <42C3E362.6070606@inria.fr>

> Christophe TROESTLER wrote:
>> I'll be glad to hear similar experiences and comments about the above
>> ideas.
>
> In my opinion, it is a good idea to always define one's own comparison
> (and hash) function.

I know many people who have "defunctorized" the Map and Set modules
and hardcoded a call to the generic compare  to be able to use
Set and Map as easily as you use List.
Even with this generic compare those Set and Map seems quite good
enough (and far better of course that using List for representing
sets and associations).

> You know better than the compiler and the runtime
> system how your data is to be compared,

Well then you are perhaps agree with the C++ folks who think
that they better know how to manage memory than the compiler and runtime
system.

> which details should be ignored,
> how to deal with cycles, and so on. In addition, your custom functions
> will be more efficient than the generic ones.
> There are several tools to
> generate automatically comparison functions from type declarations.

Which one ? I know Tywith but it is not in the standard distribution
and it requires camlp4 and there is sometimes some annoying
behaviour when you use camlp4 (such as backtraces that points
to wrong information)

> I often redefine the comparison operators (=), (<=), ... with dummy
> types at the beginning of modules to avoid using them by inadvertence
> (this does not catch uses of List.mem-like functions, though).
>
> -- Alain
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>



  reply	other threads:[~2005-06-30 12:32 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
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 [this message]
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=42164.131.254.50.45.1120134741.squirrel@mail.irisa.fr \
    --to=padiolea@irisa.fr \
    --cc=Alain.Frisch@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=debian00@tiscali.be \
    /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).