Browse thread
polymorphic equality and overloading
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Eijiro Sumii <sumii@s...> |
| Subject: | Re: polymorphic equality and overloading |
Dear Dr. Pierre Weis,
> 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.
Are the exceptions really "a few"? For example---apart from (some
representations of) mathematical entities such as rational numbers,
complex numbers, polynomials, etc.---simple database entries like
"type student = { id : int; name : string; address : string }" would
have an equality different from the polymorphic equality (in the Set
and Map modules, for instance).
> Note also that polymorphic equality is just pratical and useful,
That is exactly what I asked in my second message ("Is that just
because it is often useful?"), and if the answer is yes, that's ok for
me.
> and not confusing at all if you know something about mathematical
> entities involved in the values manipulated by Caml programs.
Unfortunately, the different treatments of equality and addition (for
example) *did* confuse a friend of mine. (He has a master's degree in
computer science in the University of Tokyo---as I also do---and
definitely knows much about mathematics and computer science.)
> Choosing Haskell for the treatment of equality in the language is just
(snip)
> All the best for your experiments with modern programming languages
Oh, I *love* OCaml.:-) As I wrote in a previous message, I'm not a
Haskell advocator. (By the way, I've been programming in "modern"
languages---such as Scheme, Standard ML, Caml and Haskell---for 5
years, or 15 years if you admit LOGO as a modern language.)
Best wishes,
// Eijiro Sumii <sumii@saul.cis.upenn.edu>
//
// currently visiting: Department of Computer and Information Science,
// School of Engineering and Applied Science, University of Pennsylvania