Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Gabriel Scherer <gabriel.scherer@gmail.com>
To: bob zhang <bobzhang1988@gmail.com>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Absolute path in the module system
Date: Tue, 4 Dec 2012 23:59:20 +0100	[thread overview]
Message-ID: <CAPFanBExFXy7K_eBnJntsMoSstymP7pFLCLydbwvBD8eaWUKeg@mail.gmail.com> (raw)
In-Reply-To: <CANcqPu4FVHr1yqr_SJ91_8jXns1FHLwpfC6L8AdY8Th+MFLA1w@mail.gmail.com>

As far as I know, the answer is that you can't do that. In fact I
don't even know how you would do that: there is a tension between
powerful naming constructs and stability of references, and I don't
know how you would provide global references in a satisfying way.

This is a classic problem of hygienic macro systems. They are supposed
to protect two different aspects of bound identifiers "hygiene":
- new definition inside macros do not shadow identifiers in scope at
macro invocation/expansion time (it is possible, but not simple, to
emulate this property with careful preservation of scope during
macro-expansion)
- identifiers referenced by macro definitions are not shadowed by
identifier added in scope after that, before macro
invocation/expansion time; this corresponds to your question and I
don't think how you would solve that with a static expansion scheme.

If I remember correctly, the solution of hygienic macro systems is, in
effect, to do a preprocessing step of the pre-expansion source, to
enforce the convention that now name is bound twice in the same scope
by appending unique suffixes to identifiers.

On Tue, Dec 4, 2012 at 9:43 PM, bob zhang <bobzhang1988@gmail.com> wrote:
> Dear List,
>     Is there a way to express the absolute module path?
>     For example,
>        Pervasives.(+) --> actually I want it to be absolute Pervasives
> module, not shadowed by any 'open' statements?
>     Is there a way to do that? if not, is there any deep reason for
> not doing this?
>
> Thanks
>
> --
> Regards
> -- Bob
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

  reply	other threads:[~2012-12-04 23:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-04 20:43 bob zhang
2012-12-04 22:59 ` Gabriel Scherer [this message]
2012-12-04 23:38   ` bob zhang

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=CAPFanBExFXy7K_eBnJntsMoSstymP7pFLCLydbwvBD8eaWUKeg@mail.gmail.com \
    --to=gabriel.scherer@gmail.com \
    --cc=bobzhang1988@gmail.com \
    --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