English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] "polymorphic" exceptions?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-07-19 (10:47)
From: CREGUT Pierre FTRD/DTL/LAN <pierre.cregut@r...>
Subject: Re: [Caml-list] "polymorphic" exceptions?
Ok, i didn't reply to your first post immediately, so here is my 5 cents 
answer .


Quoting Markus Mottl (mottl@miss.wu-wien.ac.at):
> even though the type variable is bound in "el : 'el". This seems perfectly
> safe to me, because only the body of "add" can see the module and knows
> what 'el is when catching the exception. Code outside cannot access the
> module and therefore cannot catch the exception, which could be unsound if
> 'el is not known at this point.
I don't understand what you mean by "cannot access". add can give back
functions and you can also register functions with callbacks via global
references directly in the code of the module even if they were restricted
to the unit -> unit type or (unit -> unit) -> unit.

Those functions can raise exceptions or catch them (eg. functional catching
the exceptions raised by their function argument and printing it back or
So your exception CAN escape the scope of add and you can mix an
exception created by one call to add with one given type, with a catcher 
created by another call with another type.

exception tags are defined at link time as far as I know.
They are not so dynamic so that you can compile matching.

Pierre Cregut - pierre.cregut@rd.francetelecom.com - +33 2 96 05 16 28
FTR&D - DTL/MSV - 2 avenue Pierre Marzin - 22307 Lannion Cedex - France
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr