Browse thread
ambitious proposal: polymorphic arithmetics
-
Eijiro Sumii
- Sébastien Hinderer
- Richard Jones
- William Lovas
- Christophe TROESTLER
- Marcin 'Qrczak' Kowalczyk
- Jon Harrop
[
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: | Sébastien Hinderer <Sebastien.Hinderer@e...> |
| Subject: | Re: [Caml-list] ambitious proposal: polymorphic arithmetics |
Hi, > So here it goes: why don't we have polymorphic +, -, etc. while we > have polymorphic =, <, etc.? Many novices and (at least) some experts > feel that +., -., etc. are not quite nice. Why not define +, -, > etc. for as many types as possible such as integers, floating-point > numbers, and tuples? I think they can be implemented almost in the > same efficient way as =. They can also raise an exception if applied > to unsupported values such as functions, just as = does. By the way, why isn't it possible to detect this kind of errors at compile-time ? Isn't the type-system strong enough ? > P.S. I believe I'm not proposing anything as serious as Haskell type > classes. I was wondering if it would be theoretically possible to have Haskell-like type classes in Caml ? If it is possible in theory, is it something Caml developers plan to implement, one day ? Thanks, Sébastien.