caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Martin Jambon <m.jambon@ibcp.fr>
To: Ryan Tarpine <rtarpine@hotmail.com>
Cc: <caml-list@inria.fr>
Subject: Re: [Caml-list] Another q about many types
Date: Mon, 18 Feb 2002 15:04:49 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.33L2.0202181431440.1324-100000@pc-bioinfo1.ibcp.fr> (raw)
In-Reply-To: <F1776aa2qSPu147CKHM00018281@hotmail.com>

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


  reply	other threads:[~2002-02-18 14:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-16  3:16 Ryan Tarpine
2002-02-18 14:04 ` Martin Jambon [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-02-15 11:04 Martin Jambon
2002-02-15  1:48 Ryan Tarpine
2002-04-15  8:06 ` Christian Gillot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.33L2.0202181431440.1324-100000@pc-bioinfo1.ibcp.fr \
    --to=m.jambon@ibcp.fr \
    --cc=caml-list@inria.fr \
    --cc=rtarpine@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).