From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA04080; Wed, 22 Sep 2004 17:50:26 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA01700 for ; Wed, 22 Sep 2004 17:50:25 +0200 (MET DST) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i8MFoMYI006907 for ; Wed, 22 Sep 2004 17:50:24 +0200 Received: from [192.168.1.200] (ppp202-133.lns1.syd3.internode.on.net [203.122.202.133]) by smtp1.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id i8MFoF4Y026487; Thu, 23 Sep 2004 01:20:17 +0930 (CST) Subject: Re: [Caml-list] Re: OCAML Downcasting? From: skaller Reply-To: skaller@users.sourceforge.net To: "Marcin 'Qrczak' Kowalczyk" Cc: cvalente@co.sapo.pt, caml-list In-Reply-To: <87fz5aphr0.fsf@qrnik.zagroda> References: <1095819964.2580.1016.camel@pelican.wigram> <87d60eizlh.fsf@qrnik.zagroda> <200409221350.36436.cvalente@co.sapo.pt> <87fz5aphr0.fsf@qrnik.zagroda> Content-Type: text/plain; charset=UTF-8 Message-Id: <1095868215.2581.44.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 23 Sep 2004 01:50:15 +1000 Content-Transfer-Encoding: 8bit X-Miltered: at concorde with ID 41519F3E.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 downcasting:01 sourceforge:01 2004:99 marcin:01 'qrczak':01 kowalczyk:01 sapo:99 heuristics:01 divisor:01 statically:01 int-:01 nonzero:01 gratuitous:01 modulus:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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, 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