Re: Rebinding exception declarations

From: Xavier Leroy (
Date: Sun Oct 17 1999 - 16:22:29 MET DST

Date: Sun, 17 Oct 1999 16:22:29 +0200
From: Xavier Leroy <>
To: skaller <>, Manuel Fahndrich <>
Subject: Re: Rebinding exception declarations
In-Reply-To: <>; from skaller on Fri, Oct 15, 1999 at 08:52:12AM +1000

> Actually, I think there is a more syntactic problem: ocaml uses
> special 'kinds' of bindings, for some reason that escapes me:
> type X = ..
> class X = ..
> exception ..
> let X = ..
> let rec X =
> module X =

The reason is easy: the syntax and the meaning of the right-hand side
depends on the 'kind' of the thing being bound. E.g. "t * t" in the
right-hand side can be a product type (for a type t = declaration)
or a squaring operation (for a let x = declaration).

Even human readers need the initial keyword to know how to make sense
of the definition, I guess.

> which permit recursion with an 'and' option. Unfortunately,
> this syntax does not permit these kinds of bindings to be
> mutually recursive (quite aside from the semantic issues).

The problem is exactly "semantic issues". We know how to type-check
and compile mutually-recursive value definitions, and also
mutually-recursive type definitions. Mutual recursion between module
definitions, for instance, is a research problem that is still mostly
open. Mutual recursion between, say, a module and a class seems at
least as problematic.

Coming back to Manuel Fähndrich original point on rebinding of
exceptions: this looks like a natural thing to have. We can rebind
datatype constructors already, so why not exceptions. I'll see what
we can do about it.

- Xavier Leroy

This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:27 MET