Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
aliasing exceptions with a let ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-03-01 (17:08)
From: Ralf Treinen <Ralf.Treinen@l...>
Subject: aliasing exceptions with a let ?
Is it possible to alias an exception as with functions or type definitions?
I would like to write a module that is a "virtual module" in the sense
that it just regroups identifiers that are defined in other modules.
This works fine for types and functions:

  type running_prog = Programs.running_prog;;
  let is_finished = Programs.is_finished;;

Apparently, I cannot do the same thing with exceptions (and hence
with functions that raise an exception). The obvious solution is to
write a wrapper as in

  exception Erreur_load of string;;
  let load s =
      Analyse_program.load s
        Analyse_program.Erreur_load s -> raise (Erreur_load s)

which is quite awkward. It would be nice to have a way to define an alias
for an exception in the same way as for identifiers and types.

Ralf Treinen.

Ralf Treinen,      L.R.I. Bât. 490,     Université Paris-Sud,
F91405 Orsay cedex, France.