Version française
Home     About     Download     Resources     Contact us    
Browse thread
Exceptions and .mli-files?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques GARRIGUE <garrigue@k...>
Subject: Re: Exceptions and .mli-files?
From: Jens Olsson <jenso@csd.uu.se>

> ? 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
raised.

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.

Regards,

	Jacques
---------------------------------------------------------------------------
Jacques Garrigue      Kyoto University     garrigue at kurims.kyoto-u.ac.jp
		<A HREF=http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/>JG</A>