From: Pierre Weis <Pierre.Weis@inria.fr>
Subject: Re: Type-checking and raise
In-Reply-To: <199702041222.NAA03750@sisley.prism.uvsq.fr> from Denis BARTHOU at "Feb 4, 97 01:22:43 pm"
To: Denis.Barthou@prism.uvsq.fr (Denis BARTHOU)
Date: Tue, 4 Feb 1997 15:04:09 +0100 (MET)
> Is there any type-checking for "raise" ? Indeed,
> raise Not_found expr
> for instance do not trigger any type error, although raise
> is of type exn -> 'a. Any reason for such a behaviour ?
> --Denis Barthou
Raise has type exn -> 'a, thus raise Not_found has type 'a, and can be
applied to any number of values (ad libitum). This polymorphic type
scheme for raise is semantically sound, since nothing will be returned
by raise Not_found. This polymorphic type scheme is also mandatory, if
we want to write programs that raise exceptions in conditionals
(remember that all the arms of a conditional must have the same type).
INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis
This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:09 MET