From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA16249 for caml-redistribution; Thu, 14 Oct 1999 14:59:35 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA06852 for ; Wed, 13 Oct 1999 18:59:59 +0200 (MET DST) Received: from mail3.microsoft.com (mail3.microsoft.com [131.107.3.123]) by nez-perce.inria.fr (8.8.7/8.8.7) with SMTP id SAA00701 for ; Wed, 13 Oct 1999 18:59:57 +0200 (MET DST) Received: from 157.54.9.100 by mail3.microsoft.com (InterScan E-Mail VirusWall NT); Wed, 13 Oct 1999 09:59:31 -0700 (Pacific Daylight Time) Received: by INET-IMC-03 with Internet Mail Service (5.5.2650.21) id <454GQPLH>; Wed, 13 Oct 1999 09:59:31 -0700 Message-ID: <783D93998201D311B0CF00805FEAA07B7E8F5F@RED-MSG-42> From: Manuel Fahndrich To: "'caml-list@inria.fr'" Subject: Rebinding exception declarations Date: Wed, 13 Oct 1999 09:59:50 -0700 X-Mailer: Internet Mail Service (5.5.2650.21) Sender: weis 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.