> 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