caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Andreas Rossberg <rossberg@ps.uni-sb.de>
To: Sven <luther@dpt-info.u-strasbg.fr>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Style question
Date: Tue, 11 Sep 2001 16:29:28 +0200	[thread overview]
Message-ID: <3B9E1FC8.605D057A@ps.uni-sb.de> (raw)
In-Reply-To: <20010911141602.A30234@dpt-info.u-strasbg.fr>

Sven wrote:
> 
> > Not sure, since I don't understand your code snippet, or how it is
> > related to local or open. Could you clarify a bit?
> 
> Well, consider :
> 
> let module M = struct let f x = x * x end in M.f 5 ;;
> 
> Sure, you still have to access f trough M., but you could imagine something
> with the open/include directive.

I suspect you are mixing up issues. Brian asked what the best OCaml
translation of SML's "local" construct would be. In SML "local" allows
to limit the scope of declarations. Unlike "let", its body is not an
expression but again a sequence of declarations, so that the whole
construct is a declaration. I argued that the one of the few real uses
of that construct is to restrict the scope of an "open" declaration in
SML.

So we were not discussing how to encode something like "let open M in
exp" in OCaml (although that also might be an issue when translating SML
to OCaml). That is relatively easy with "let module" and has been
discussed here before, IIRC:

	let module Aux = struct open M val body = exp end in Aux.body

Was that what you were aiming at?

	- Andreas

-- 
Andreas Rossberg, rossberg@ps.uni-sb.de

"Computer games don't affect kids; I mean if Pac Man affected us
 as kids, we would all be running around in darkened rooms, munching
 magic pills, and listening to repetitive electronic music."
 - Kristian Wilson, Nintendo Inc.
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


  parent reply	other threads:[~2001-09-11 14:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-09 21:00 Brian Rogoff
2001-09-11  9:59 ` Andreas Rossberg
2001-09-11 10:55   ` Sven
2001-09-11 12:08     ` Andreas Rossberg
2001-09-11 12:16       ` Sven
2001-09-11 14:28         ` Brian Rogoff
2001-09-11 14:29         ` Andreas Rossberg [this message]
2001-09-11 18:11   ` Brian Rogoff
2001-09-12  9:03     ` Andreas Rossberg
2001-09-11 18:58 Krishnaswami, Neel
2001-09-12  9:14 ` Andreas Rossberg
2001-09-12 10:24 Dave Berry

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=3B9E1FC8.605D057A@ps.uni-sb.de \
    --to=rossberg@ps.uni-sb.de \
    --cc=caml-list@inria.fr \
    --cc=luther@dpt-info.u-strasbg.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;
as well as URLs for NNTP newsgroup(s).