English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Rebinding exception declarations
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1999-10-18 (14:16)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: Rebinding exception declarations
> 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