Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Re: OCAML Downcasting?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-09-22 (15:50)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Re: OCAML Downcasting?
On Wed, 2004-09-22 at 23:15, Marcin 'Qrczak' Kowalczyk wrote:
> Cláudio Valente <> writes:

> I meant exhaustive tests, not heuristics for easy cases where the
> divisor is constant.

It is of course possible to it entirely statically right
now in Ocaml by using an abstract type for a non-zero int.
Not as good as CDuce's interval arithmetic because you have
to handle the 0 in the int-> nonzero_int conversion, but still
afterwards you can divide without an exception.

Some functions, eg multiplication, preserve non-zeroness,
so in many cases you can use static typing to avoid
gratuitous checks for zero. 

As you may have noted in my Felix example -- exceptions
are just too powerful: I forgot to catch the exception. 
I fixed my modulus function too .. but no doubt I have
missed others. Perhaps static checking would make
programming harder -- but nothing is harder than
exhaustively testing a complex program.

John Skaller,
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: