> And regarding exceptions specifically, another of their rules is
> this one:
>
> # Use exceptions only for exceptional situations.
For example, when List.find fails to find the item in the list? ;-)
Boxing the result in an option type produces more garbage.
With automatic memory management, there is less need to clean up after
an exception. Thus exceptions can be used quite freely in both Erlang
and o'caml.
ML was designed for theorem provers, and many of its features can be
traced back to that specific purpose. I read somewhere that exception
was introduced in ML for back-tracking, which occurs frequently during
the normal course of trying out various tactics to prove a theorem.
Even today, exceptions are used heavily in coq. Could you comment on
your experiences with the usage of caml exceptions in coq? Are
exceptions raised there "only for exceptional situations"?
Thanks,
Haoyang Wang