Re: entiers et reels

Thorsten Ohl (ohl@crunch.ikp.physik.th-darmstadt.de)
Fri, 5 Jan 1996 22:14:07 +0100

Date: Fri, 5 Jan 1996 22:14:07 +0100
Message-Id: <9601052114.AA03157@crunch>
From: Thorsten Ohl <ohl@crunch.ikp.physik.th-darmstadt.de>
To: Pierre Weis <Pierre.Weis@inria.fr>
Subject: Re: entiers et reels
In-Reply-To: <199601051827.TAA27239@pauillac.inria.fr>
<199601051827.TAA27239@pauillac.inria.fr>

>>>>> "Pierre" == Pierre Weis <Pierre.Weis@inria.fr> writes:

Pierre> En revanche il n'y a pas de sens raisonable a` une addition
Pierre> polymorphe, et c'est pourquoi nous avons une collection
Pierre> d'additions monomorphes.

[ No, I'm not going to embarrass myself by trying to respond in
French ... :-) ]

Maybe I'm too dense or I have been exposed to too much Fortran, but I
don't fully understand:

Standard ML has it (at least in the New Jersey incarnation), so why
can't Caml? As long as all operands are of the same type, the
semantics should be obvious.

I agreee that promotion will open a can of worms (standard example:
(1/2)*2.0 would most likely evaluate to 0.0, which is even more likely
_not_ what the programmer intended). But wouldn't it be possible to
assign types to subexpressions based on the context in such a way that
no information can be lost?

I asking out of curiosity, but from the user's perspective I want to
add that polymorphic arithmetic is just soooo convenient. It can be
abused, but it can also make programs much more readable, if used with
discretion. In particular if types have a natural inclusion (like
natural, integer, rational, real and complex numbers). Also for
vector spaces: it is usually not ambigious whether a scalar or an
inner product is intended.

Greetings,
-Thorsten

/// Thorsten Ohl, TH Darmstadt, Schlossgartenstr. 9, D-64289 Darmstadt, Germany
//// http://crunch.ikp.physik.th-darmstadt.de/~ohl //// voice: +49-6151-16-3116
///// email: Thorsten.Ohl@Physik.TH-Darmstadt.de /// secretary: 2072, fax: 2421