Re: Exceptions and .mli-files?

From: Jacques GARRIGUE (
Date: Tue Jul 27 1999 - 04:20:36 MET DST

Subject: Re: Exceptions and .mli-files?
In-Reply-To: Your message of "Sat, 24 Jul 1999 15:58:02 +0200"
Message-Id: <>
Date: Tue, 27 Jul 1999 11:20:36 +0900
From: Jacques GARRIGUE <>

From: Jens Olsson <>

> ? Is there any particular reason for not including declarations
> of exceptions in .mli files (in some way)?

Asked this way, you will get the wrong answer:
But of course you can declare exception in .mli files!
You just define them the same way as in .ml files.

What you were asking is probably a way of indicating which function
may raise which exceptions, as in Java or C++.
The problem is that Caml is a functional programming language, meaning
that you can pass functions (potentially raising exceptions) to other
functions. This makes it very hard to check which exceptions may be

By the way some people work on that (infering which exceptions may be
raised at which point), but this shall be rather seen as a debugging
tool than a part of the compiler itself.

> For me it seems that exceptions 'exported' from modules are an important
> part of the interface of the module. It's not a problem, I mean one can
> document the exceptions easily but I'm just curious.

Plain text is the only way I see for now.


Jacques Garrigue Kyoto University garrigue at
                <A HREF=>JG</A>

This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:23 MET