Re: Exceptions polymorphes

From: Christophe Raffalli (raffalli@univ-savoie.fr)
Date: Tue Nov 18 1997 - 18:59:37 MET


Date: Tue, 18 Nov 1997 17:59:37 +0000
From: Christophe Raffalli <raffalli@univ-savoie.fr>
To: Pascal Zimmer <Pascal.Zimmer@ens-lyon.fr>
Subject: Re: Exceptions polymorphes

If you do what you suggest, the following program crashes (and is well
typed *)

exception Found of 'a;;

let rec assoc_exn n = function
  [] -> raise Not_found
| ((x,y)::l) ->
  if x = n then raise Found y else assoc_exn n l

try
  assoc_exn 1 [1,2]
with
  Found x -> print_string x (* x will be an integer, not a string *)



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