>> ...
>> From: Markus Mottl <mottl@miss.wu-wien.ac.at>
>> Date: Thu, 20 Apr 2000 20:52:34 +0200 (MET DST)
>> Cc: caml-list@inria.fr (OCAML)
>> Content-Type: text/plain; charset=us-ascii
>> Sender: Pierre.Weis@inria.fr
>>
>> > In another life I wrote lots of numerical linear algebra programs, and I
>> > find that a little overloading would make the code a lot nicer.
>>
>> I admit: I don't write this much numerical code so I don't have many
>> opportunities to complain about missing operator overloading there...
>> ...
Overloading is not needed in caml: remember that you can define your
own infix operators. I have done this for a minimalistic complex
number type, using +: -: /: and *: Since the first (or first 2)
characters determine both precedence and associativity, this works
well.
This also avoids the mixed-arithmetic errors, such as
x = 1/2 * y
which in e.g. Python will always return 0, but give type errors in
caml (when x and y are not integers)
Cheers,
Michael
This archive was generated by hypermail 2b29 : Tue Apr 25 2000 - 19:03:46 MET DST