caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* aliasing exceptions with a let ?
@ 2000-03-01 16:22 Ralf Treinen
  2000-03-06  8:55 ` Xavier Leroy
  0 siblings, 1 reply; 2+ messages in thread
From: Ralf Treinen @ 2000-03-01 16:22 UTC (permalink / raw)
  To: caml-list

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 =
    try
      Analyse_program.load s
    with
        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.        http://www.lri.fr/~treinen  






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

* Re: aliasing exceptions with a let ?
  2000-03-01 16:22 aliasing exceptions with a let ? Ralf Treinen
@ 2000-03-06  8:55 ` Xavier Leroy
  0 siblings, 0 replies; 2+ messages in thread
From: Xavier Leroy @ 2000-03-06  8:55 UTC (permalink / raw)
  To: Ralf Treinen, caml-list

> Is it possible to alias an exception as with functions or type definitions?

Not currently, but I agree it's a desirable feature.  Actually, I
implemented it some time ago, but took it off the released version for
various reasons.  I'll try to put it in release 3.00.

- Xavier Leroy



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

end of thread, other threads:[~2000-03-06 13:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-01 16:22 aliasing exceptions with a let ? Ralf Treinen
2000-03-06  8:55 ` Xavier Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).