From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA05982; Mon, 18 Feb 2002 15:16:16 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA21693 for ; Mon, 18 Feb 2002 15:16:15 +0100 (MET) Received: from audi.ibcp.fr (audi.ibcp.fr [193.51.160.127]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g1IEGED24690 for ; Mon, 18 Feb 2002 15:16:14 +0100 (MET) Received: from pc-bioinfo1.ibcp.fr (pc-bioinfo1.ibcp.fr [193.51.160.63]) by audi.ibcp.fr (Postfix) with ESMTP id 92212FC44; Mon, 18 Feb 2002 15:16:14 +0100 (CET) Date: Mon, 18 Feb 2002 15:04:49 +0100 (CET) From: Martin Jambon X-X-Sender: To: Ryan Tarpine Cc: Subject: Re: [Caml-list] Another q about many types In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 15 Feb 2002, Ryan Tarpine wrote: > Unfortunately, this means that in order to raise an exception with an object > of type my_object, not only its own object_data but the data of all the > variables stored in object_ivs must be of the same type. I've tried making > the exception type like this: > type allowed_exc = [ `PNone | `PInteger of int | `PFloat of float | > `PString of string ];; > exception EError of allowed_exc my_object;; > to make the type of allowed exceptions somewhat lax. But, given a single > ('a my_object), how can I coerce it to an (allowed_exc my_object) if > possible? It has to recursively coerce all the variables in object_ivs. > I've never done coercion at all before. Try the following raise (EError (obj :> allowed_exc my_object)) instead of raise (EError obj) Martin ------------------- 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