Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* Rebinding exception declarations
@ 1999-10-13 16:59 Manuel Fahndrich
  1999-10-14 22:52 ` skaller
  0 siblings, 1 reply; 5+ messages in thread
From: Manuel Fahndrich @ 1999-10-13 16:59 UTC (permalink / raw)
  To: 'caml-list@inria.fr'


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.




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1999-10-18 14:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-13 16:59 Rebinding exception declarations Manuel Fahndrich
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox