Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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 <cvalente@co.sapo.pt> 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, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners