Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Harrison, John R" <john.r.harrison@intel.com>
To: OCaml <caml-list@yquem.inria.fr>
Subject: Stricter version of #use ?
Date: Tue, 24 Mar 2009 11:00:50 -0700	[thread overview]
Message-ID: <BC67582D4FC8ED45BAABE48343BF5711033C59A678@azsmsx501.amr.corp.intel.com> (raw)

I'd like a variant of the #use directive for reading in an OCaml
source file, but with the property that it halts immediately on the
first error anywhere in a nesting of #use'd files. For example,
suppose you have a file "root.ml" containing

  let x = 1;;

  #use "branch.ml";;

  let y = 2;;

and a file "branch.ml" containing

  let u = 3;;

  let v = failwith "X";;

  let w = 4;;

Then I want the following to stop immediately on the failure inside
"branch.ml" and hence not evaluate the "y = 2" line in "root.ml" as it
currently does:

          Objective Caml version 3.10.0

  # #use "root.ml";;
  val x : int = 1
  val u : int = 3
  Exception: Failure "X".
  val y : int = 2

On the other hand, I'd want it to keep the results of the x = 1 and
u = 3 lines, not roll back everything. Is this easy to accomplish?
(By the way, I'm ultimately interested in using this together with
camlp5, and possibly with the new camlp4, if that makes a difference.)

John.


             reply	other threads:[~2009-03-24 18:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-24 18:00 Harrison, John R [this message]
2009-03-24 22:25 ` Zheng Li
2009-03-25  0:14   ` Harrison, John R
2009-03-25  8:32     ` Zheng Li

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=BC67582D4FC8ED45BAABE48343BF5711033C59A678@azsmsx501.amr.corp.intel.com \
    --to=john.r.harrison@intel.com \
    --cc=caml-list@yquem.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