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
Re: 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-15 (07:18)
From: Pierre Weis <Pierre.Weis@i...>
Subject: Re: Rebinding exception declarations
> Manuel Fahndrich wrote:
> > 
> > While we are at wishing for new features in OCaml, let me add a minor
> > feature to the list:
> > 
> > Rebinding of 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 = 
> 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).

Not aside from, but due to semantic issues.

> I find this syntax strange, I would have expected
> 	let X = 
> be enough for all kinds of bindings, determined by the
> kind of the right hand side.

I understand: you start everything by let and then distinguish the
construction you are using by some keyword to determine the kind of
the right hand side. It would ressemble something like:

 let x = type ..
 let c = class ..
 let E = exception ..
 let M = module ..
 let _ = .. (for expression only)

I think the regular syntax of Caml is simpler and more intuitive.

Apart from syntax, once more it is a semantic problem: modules are not
values, values are not types, exception are not classes, classes are
not functors. We prefer to have a direct reflection of these semantics
distinctions in the syntax: we hope it may induce a clear distinction
in the programmer's ideas.

> The distinction between sequential and recursive bindings for
> functions seems anomolous [let .. in can be used for that].

It is not anomalous [let .. in cannot be used for that]. This is due to the
static binding discipline of Caml.

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://cristal.inria.fr/~weis/