Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Christophe Raffalli <raffalli@univ-savoie.fr>
To: Pascal Zimmer <Pascal.Zimmer@ens-lyon.fr>
Cc: caml-list@inria.fr
Subject: Re: Exceptions polymorphes
Date: Tue, 18 Nov 1997 17:59:37 +0000	[thread overview]
Message-ID: <3471D789.3782@univ-savoie.fr> (raw)
In-Reply-To: <199711181357.OAA02954@dragon.ens-lyon.fr>

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 *)




      parent reply	other threads:[~1997-11-19  8:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-11-18 13:57 Pascal Zimmer
1997-11-18 15:12 ` David Monniaux
1997-11-18 17:59 ` Christophe Raffalli [this message]

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=3471D789.3782@univ-savoie.fr \
    --to=raffalli@univ-savoie.fr \
    --cc=Pascal.Zimmer@ens-lyon.fr \
    --cc=caml-list@inria.fr \
    /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