From: Pierre Weis <Pierre.Weis@inria.fr>
To: sumii@saul.cis.upenn.edu (Eijiro Sumii)
Cc: caml-list@inria.fr
Subject: Re: polymorphic equality and overloading
Date: Thu, 6 Jul 2000 00:15:38 +0200 (MET DST) [thread overview]
Message-ID: <200007052215.AAA29234@pauillac.inria.fr> (raw)
In-Reply-To: <20000705173047X.sumii@saul.cis.upenn.edu> from Eijiro Sumii at "Jul 5, 100 05:30:47 pm"
> > Look at mathematics: equality is polymorphic. Addition is just overloaded.
>
> But as you know (and as I wrote in my previous messages), the
> polymorphic equality in Caml is not at all the "equality in
> mathematics" for many (or most?) datatypes.
No. As you know (and as I wrote in the Caml FAQ) the polymorphic
equality in Caml is the "equality in mathematics" for many (or most?)
datatypes. A few exceptions are (as in maths)
-- functions, for which mathematical equality needs complex demonstrations
-- quotient types using complex equivalence relations, such as
rational numbers or even reals or complex numbers.
Note that for those values equality is simply undecidable in general.
Note also that polymorphic equality is just pratical and useful, and
not confusing at all if you know something about mathematical entities
involved in the values manipulated by Caml programs. I would not
expect mathematical equality to decide if any two real numbers are
equal or not, since I know this is not decidable. I just would like to
be able to demonstrate the equality of 2 particular real numbers, and
hope the equality to be an extension of equality on simpler numbers,
such as integers or decimal point numbers or even rational numbers,
because I need a valid answer in those simple cases. Unless for the
rational case, it is exactly what is now the Caml polymorphic
equality; going further to extend equality for rational numbers or
even any other user's defined data type is difficult and a current
research area. In the meantime, current polymorphic equality is the
simplest way of handling semantic equality in a polymorphic language.
Put it another way: polymorphic equality in Caml has some drawbacks,
some of them you should expect, since they are directly burried from
mathematics, few others you have to learn, but it is worth the
(little) effort.
Choosing Haskell for the treatment of equality in the language is just
a kind of misunderstanding of this powerful language and its profund
differences wrt other traditional programming languages. Tell me you
would prefer Haskell's clean lazy semantics, over Caml's strict
interpretation of computation. Tell me also you would prefer monads
and their fascinating categorical origin and propertie, over Caml's
trivial and traditional way of handling loops and sequences and side
effects. Tell me again you hate Caml's oversimplified printf compared
to the so versatile and complex Haskell's make_string. If you tell me
this kind of thing I will be glad to tell you Caml is not for you; I
will just warn you that all this Haskel powerful new stuff is really a
bit confusing for the beginner. But no doubt that if you can pay the
price it is worth the investment. You might also come back to Caml
after a while, just because it handles trivially a lot of useful
features (such as debugging); anyway, you will have learn a lot of
interesting things about programming in using Haskell. May be in the
first place, not to rely too much on polymorphic equality in your
programs, but to define your own complex equivalence relations on your
own complex data types.
All the best for your experiments with modern programming languages
Pierre Weis
INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://cristal.inria.fr/~weis/
next prev parent reply other threads:[~2000-07-05 22:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-06-29 21:10 Eijiro Sumii
2000-06-30 17:08 ` Brian Rogoff
2000-06-30 17:51 ` Eijiro Sumii
2000-07-04 7:09 ` Jacques Garrigue
2000-07-04 12:42 ` Eijiro Sumii
2000-07-05 1:11 ` Jacques Garrigue
2000-07-05 2:37 ` Eijiro Sumii
2000-07-05 21:22 ` Pierre Weis
2000-07-05 21:30 ` Eijiro Sumii
2000-07-05 22:15 ` Pierre Weis [this message]
2000-07-05 23:09 ` Eijiro Sumii
2000-07-06 17:18 ` Benjamin Werner
2000-07-05 22:40 John R Harrison
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=200007052215.AAA29234@pauillac.inria.fr \
--to=pierre.weis@inria.fr \
--cc=caml-list@inria.fr \
--cc=sumii@saul.cis.upenn.edu \
/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