From: John Prevost <j.prevost@cs.cmu.edu>
To: caml-list@inria.fr
Subject: Local opening of modules
Date: Tue, 27 Oct 1998 15:35:35 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.3.95L.981027152714.13499A-100000@naiad.fac.cs.cmu.edu> (raw)
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
next reply other threads:[~1998-10-28 12:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-10-27 20:35 John Prevost [this message]
1998-11-10 16:04 ` Anton Moscal
1998-11-10 21:22 ` John Prevost
1998-11-25 15:17 ` Objects as sums Anton Moscal
1998-11-26 15:58 ` Didier Remy
1998-11-28 10:46 ` Anton Moscal
1998-11-30 12:35 ` Jerome Vouillon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.3.95L.981027152714.13499A-100000@naiad.fac.cs.cmu.edu \
--to=j.prevost@cs.cmu.edu \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox