Re: Rebinding exception declarations

From: Pierre Weis (Pierre.Weis@inria.fr)
Date: Fri Oct 15 1999 - 09:12:07 MET DST


From: Pierre Weis <Pierre.Weis@inria.fr>
Message-Id: <199910150712.JAA01968@pauillac.inria.fr>
Subject: Re: Rebinding exception declarations
To: skaller@maxtal.com.au (skaller)
Date: Fri, 15 Oct 1999 09:12:07 +0200 (MET DST)
In-Reply-To: <38065E9C.E03FBF19@maxtal.com.au> from "skaller" at Oct 15, 99 08:52:12 am

> 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/



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