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 RAA23017; Wed, 19 Nov 2003 17:29:52 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA22407 for ; Wed, 19 Nov 2003 17:29:51 +0100 (MET) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id hAJGTo123705 for ; Wed, 19 Nov 2003 17:29:50 +0100 (MET) Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.11.6/8.10.1) with ESMTP id hAJGTiC13192; Wed, 19 Nov 2003 10:29:44 -0600 (CST) Date: Wed, 19 Nov 2003 11:29:16 -0600 (CST) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: Martin Berger cc: Caml Mailing List Subject: Re: [Caml-list] GC and file descriptors In-Reply-To: <3FBB5784.9040303@dcs.qmul.ac.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 bug:01 debugging:01 debugging:01 untyped:01 fledged:01 annotations:01 debug:01 debug:01 compilers:01 descriptors:01 int:01 int:01 nov:01 checking:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, 19 Nov 2003, Martin Berger wrote: > imagine having 100000 lines of code, mostly mature, and you are trying to > track down a little bug. for that you want to see with what arguments the > function > > let f m n = > body;; > > is called. assume that function has the type > > f : int -> ( int -> A throws E ) throws E > > so for debugging you modify f to > > let f m n = > print_debug "calling f with arguments " m n; > body > > if print_debug may throw something not in E and if f is used all over > your code, you will have make an enourmous of changes (and later revert > them) just to get a silly little debugging mechanism going. i would hate > having to do this. being able to switch off exception would be a great > help in this situation. If calling print_debug adds an error condition (i.e. can throw an exception), then you have two choices: 1) Fix print_debug so it doesn't throw an exception, 2) Do the following instead: let f m n = try print_debug "calling f with arguments " m n with _ -> (); body I'd recommend #1 myself. Debugging code should not have any effect on the program (otherwise, you are opening yourself up to heisenbugs, where the program works correctly with debugging turned on, and fails with debugging turned off). > > being able to switch on or off exception checking is just an instance of > a more general phenomenon where you run different checks on your software > independently of each other. i expect future compilers to be more flexible > in this regard, maybe offering plug-in typing systems from untyped to > fully fledged dependent types and proof annotations. > The problem with this is that then everyone immediately turns exception checking off and the value of the feature is greatly reduced (at best). -- "Usenet is like a herd of performing elephants with diarrhea -- massive, difficult to redirect, awe-inspiring, entertaining, and a source of mind-boggling amounts of excrement when you least expect it." - Gene Spafford Brian ------------------- 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