From: Manuel Fahndrich <maf@microsoft.com>
To: "'caml-list@inria.fr'" <caml-list@inria.fr>
Subject: Rebinding exception declarations
Date: Wed, 13 Oct 1999 09:59:50 -0700 [thread overview]
Message-ID: <783D93998201D311B0CF00805FEAA07B7E8F5F@RED-MSG-42> (raw)
While we are at wishing for new features in OCaml, let me add a minor
feature to the list:
Rebinding of exception declarations.
Currently, in OCAML I cannot do the following:
module A =
struct
exception E
end
module B =
struct
exception E = exception A.E
end
In order to have an exception declaration in a module, it must syntactically
appear there. That prevents me from repackaging my modules in a different
way for the programmer interface. The only way around it is currently to
define a brand new exception and wrap all interface functions with a handler
that translates A.E into B.E.
One argument against providing such exception rebinding is that it
introduces aliasing between exception constructors. However, OCAML already
has that problem now through functors. Consider:
module type Argsig =
sig
module X : sig exception E end
module Y : sig exception E end
end
module F = functor(Arg : Argsig) ->
struct
try ...
with
Arg.X.E -> ...
| Arg.Y.E -> ...
end
module A =
struct
exception E
end
module Z = F(struct module X = A module Y = A end)
Within Z, exceptions Arg.X.E and Arg.Y.E are aliased.
-Manuel
P.S. Exception rebinding is standard in SML.
next reply other threads:[~1999-10-14 12:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-10-13 16:59 Manuel Fahndrich [this message]
1999-10-14 22:52 ` skaller
1999-10-15 7:12 ` Pierre Weis
1999-10-17 11:15 ` skaller
1999-10-17 14:22 ` Xavier Leroy
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=783D93998201D311B0CF00805FEAA07B7E8F5F@RED-MSG-42 \
--to=maf@microsoft.com \
--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