Date: Tue, 27 Oct 1998 15:35:35 -0500 (EST)
From: John Prevost <j.prevost@cs.cmu.edu>
To: caml-list@inria.fr
Subject: Local opening of modules
This is a question that I found asked back in the logs, but which I
found no answer to:
Is there any good reason that Caml doesn't have a mechanism like SML's
to open a module locally? For example:
let open Num in
let a = num_of_int 2739 in
let b = num_of_int 234 in
let bar = a +/ b;;
an even better example would be one in which the symbol "+/" was
actually "+", like in the SML bignum package. A friend of mine used
this mechanism quite well in a project where bignum math was used in
only a few restricted places. The rest of the file didn't need to be
polluted namespace-wise with the bignum package (and if there were, say,
another package that wanted +/ it wouldn't cause problems... There are
only so many reasonable versions of + you can make without getting into
collision problems, after all.)
Maybe there's a technical constraint in the way Caml is organized that
keeps this from being done?
jmp
This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:16 MET