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 AAA05788; Wed, 11 Feb 2004 00:07:23 +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 AAA05806 for ; Wed, 11 Feb 2004 00:07:22 +0100 (MET) Received: from cs.uoregon.edu (vitalstatistix.cs.uoregon.edu [128.223.4.19]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id i1AN7Lv19636 for ; Wed, 11 Feb 2004 00:07:21 +0100 (MET) Received: from cs.uoregon.edu (chrisg@dyna6-195.cs.uoregon.edu [128.223.6.195]) (authenticated bits=0) by cs.uoregon.edu (8.12.10/8.12.10) with ESMTP id i1AN7KGK027170 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 10 Feb 2004 15:07:20 -0800 (PST) Message-ID: <4029641D.5050102@cs.uoregon.edu> Date: Tue, 10 Feb 2004 15:07:09 -0800 From: Chris GauthierDickey User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031221 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@inria.fr Subject: [Caml-list] exception or conditional Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Loop: caml-list@inria.fr X-Spam: no; 0.00; dynamically:01 resize:01 resize:01 chris:01 chris:01 ocaml:01 exception:02 exception:02 clearer:02 bounds:03 cleaner:04 execute:04 wondering:04 array:04 array:04 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I'm writing a function that is using an array that can be dynamically resized. I'm wondering if it would be better to just catch an exception if we attempt to go out of bounds in the array (at which point I resize the array), or if I should test the size using an if-then-else before I enter the main body of my function and resize then. How lightweight is the exception mechanism in ocaml? If I test the size, then any time I call this function, I have to execute the conditional statement. If I use try...with, then I'm entering an exception handling block every call to the function. Is one better than the other? Neither one makes the code clearer or cleaner, so that's not really a factor. Thanks in advance for your advice, Chris G. ------------------- 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