From: Manuel Fahndrich <firstname.lastname@example.org>
To: "'email@example.com'" <firstname.lastname@example.org>
Subject: Rebinding exception declarations
Date: Wed, 13 Oct 1999 09:59:50 -0700
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 =
module B =
exception E = exception A.E
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 =
module X : sig exception E end
module Y : sig exception E end
module F = functor(Arg : Argsig) ->
Arg.X.E -> ...
| Arg.Y.E -> ...
module A =
module Z = F(struct module X = A module Y = A end)
Within Z, exceptions Arg.X.E and Arg.Y.E are aliased.
P.S. Exception rebinding is standard in SML.
This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:27 MET