* [Caml-list] Absolute path in the module system @ 2012-12-04 20:43 bob zhang 2012-12-04 22:59 ` Gabriel Scherer 0 siblings, 1 reply; 3+ messages in thread From: bob zhang @ 2012-12-04 20:43 UTC (permalink / raw) To: Caml List 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Absolute path in the module system 2012-12-04 20:43 [Caml-list] Absolute path in the module system bob zhang @ 2012-12-04 22:59 ` Gabriel Scherer 2012-12-04 23:38 ` bob zhang 0 siblings, 1 reply; 3+ messages in thread From: Gabriel Scherer @ 2012-12-04 22:59 UTC (permalink / raw) To: bob zhang; +Cc: Caml List 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Absolute path in the module system 2012-12-04 22:59 ` Gabriel Scherer @ 2012-12-04 23:38 ` bob zhang 0 siblings, 0 replies; 3+ messages in thread From: bob zhang @ 2012-12-04 23:38 UTC (permalink / raw) To: Gabriel Scherer; +Cc: Caml List Hi, On Tue, Dec 4, 2012 at 5:59 PM, Gabriel Scherer <gabriel.scherer@gmail.com> wrote: > - 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. Yes, that's my concern > 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. Can you elaborate on that? I don't see the problems with absolute module path, one simple solution is to delete the grammar of 'open statement and local open statements', then for a single compilation unit, I can figure out the precise module path here, but this is not a beautiful solution. Thanks > > 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 -- Regards -- Bob ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-12-04 23:38 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-12-04 20:43 [Caml-list] Absolute path in the module system bob zhang 2012-12-04 22:59 ` Gabriel Scherer 2012-12-04 23:38 ` bob zhang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox