Re: Type-checking and raise

From: Pierre Weis (
Date: Tue Feb 04 1997 - 15:04:09 MET

From: Pierre Weis <>
Message-Id: <>
Subject: Re: Type-checking and raise
In-Reply-To: <> from Denis BARTHOU at "Feb 4, 97 01:22:43 pm"
To: (Denis BARTHOU)
Date: Tue, 4 Feb 1997 15:04:09 +0100 (MET)

> Hello,
> 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).

Pierre Weis

INRIA, Projet Cristal,,

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