Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Michael Hicks <mwh@cs.umd.edu>
To: Lauri Alanko <la@iki.fi>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Exceptions considered harmful
Date: Sun, 4 Jul 2004 16:24:20 -0400	[thread overview]
Message-ID: <21A5580B-CDF8-11D8-B2E6-000D93C1F22A@cs.umd.edu> (raw)
In-Reply-To: <20040704073050.GA907@la.iki.fi>

> try
>   x <- foo ()
> in
>   bar ()
> unless
>   E1 -> handle1 ()
>   E2 -> handle2 ()

The key part to this approach is that bar() is not covered by the 
exception handler.   This allows the caller to communicate the 
successfully created value into bar() through x.  In a traditional 
setting, you'd have something like

let x := NONE;
try
   x := SOME foo();
with E1 -> ....

if !x <> NONE then bar !x
else ??

Mike

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  parent reply	other threads:[~2004-07-04 20:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20040628143917.GA21847@fichte.ai.univie.ac.at>
     [not found] ` <Pine.LNX.4.44.0406290056580.1229-100000@localhost>
     [not found]   ` <20040628173400.GB26193@fichte.ai.univie.ac.at>
2004-06-29  1:02     ` skaller
2004-07-04  7:30       ` Lauri Alanko
2004-07-04 20:16         ` Christophe TROESTLER
2004-07-04 20:24         ` Michael Hicks [this message]
2004-07-05  3:42           ` skaller
2004-07-11 13:12       ` [Caml-list] " Richard Cole
2004-06-29 18:05 [Caml-list] " Brandon J. Van Every

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=21A5580B-CDF8-11D8-B2E6-000D93C1F22A@cs.umd.edu \
    --to=mwh@cs.umd.edu \
    --cc=caml-list@inria.fr \
    --cc=la@iki.fi \
    /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