Re: Local definitions

From: Xavier Leroy (Xavier.Leroy@inria.fr)
Date: Mon Oct 12 1998 - 13:39:03 MET DST


Date: Mon, 12 Oct 1998 13:39:03 +0200
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Anton Moscal <msk@post.tepkom.ru>, caml-list@inria.fr
Subject: Re: Local definitions
In-Reply-To: <Pine.LNX.4.03.9810051823001.28401-100000@post.tepkom.ru>; from Anton Moscal on Mon, Oct 05, 1998 at 06:27:18PM +0400

> Why CaML doesn't not allow the following style of local definitions:
> [...]
> or, the second variant: simply allow declaration of
> types, exceptions, open statements and others in "let-in"
> expressions with the same translation:

I think types and exceptions are best handled at the level of
modules, if necessary by creating a sub-structure to restrict their scope.

I've never found a convincing example of a type or exception
declaration local to an expression.

It is true that "let module ... in <expr>" lets you achieve the same
effect, but that's really not the intended use of "let module", which
is to allow functor applications to structures whose value components
may depend on function parameters.

> This syntax allow more convenient notation for local types,
> classes, exceptions and others definitions, than explicit usage of
> local modules.

This is true, but I'd still recommend that you don't use types,
classes and exceptions local to an expression. The module system
handles this just fine.

Best regards,

- Xavier Leroy



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