* [Caml-list] exception or conditional
@ 2004-02-10 23:07 Chris GauthierDickey
2004-02-10 23:34 ` Markus Mottl
0 siblings, 1 reply; 2+ messages in thread
From: Chris GauthierDickey @ 2004-02-10 23:07 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-02-10 23:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-10 23:07 [Caml-list] exception or conditional Chris GauthierDickey
2004-02-10 23:34 ` Markus Mottl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox