From: Chris GauthierDickey <chrisg@cs.uoregon.edu>
To: caml-list@inria.fr
Subject: [Caml-list] exception or conditional
Date: Tue, 10 Feb 2004 15:07:09 -0800 [thread overview]
Message-ID: <4029641D.5050102@cs.uoregon.edu> (raw)
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
next reply other threads:[~2004-02-10 23:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-10 23:07 Chris GauthierDickey [this message]
2004-02-10 23:34 ` Markus Mottl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4029641D.5050102@cs.uoregon.edu \
--to=chrisg@cs.uoregon.edu \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox