[m-dev.] module system discussion
Simon Taylor
stayl at cs.mu.OZ.AU
Mon Dec 17 22:58:33 AEDT 2001
On 17-Dec-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> Simon wrote:
> > On 14-Dec-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> > > Simon wrote:
> > > > On 13-Dec-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> > > > > I think the transparent_module name is misleading, and to use the
> > > following
> > > > > name would be better:
> > > > >
> > > > > :- namespace ns.
> > > > > :- end_namespace ns.
> > > >
> > > > I have no objection to this. I'm not sure whether it would be worth
> > > > adding an `:- import_namespace' declaration -- it would seem a bit
> > > > strange to import a `namespace' using an `:- import_*module*'
> declaration.
> > > > But that's a minor detail.
> > > >
> > > Actually on further consideration, a namespace declaration should be
> > > equivalent to
> > >
> > > :- import_module ns.
> >
> > That should be `:- use_module ns'.
> >
> I think it should be :- import_module. I believe that you should be able to
> use the name unqualified without having to do anything special in the module
> which defines the namespace. Everyone else should have to explicitly ask to
> use the namespace unqualified.
What about sub-modules of the module defining the namespace?
For consistency, I think the namespace should be imported as if by
`:- use_module' everywhere, even in the module defining it.
> > > :- transparent_module ns.
> > > :- end_transparent_module ns.
> > >
> > > that way the parent module can use the items defined inside the
> namespace
> > > without having to do anything.
> >
> > That doesn't deal with the issue I raised. It should still be possible
> > to `:- import_module' the `namespace' in order to refer to the items
> > it contains without qualification.
> >
> You are correct.
>
> :- using_namespace ns.
>
> seems to be the standard in C# and C++.
`:- using_namespace' would be confusing because in Mercury `using' a
module implies requiring qualifiers for all uses of items from that
module. I think it's better to just use `:- import_module'.
Simon.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list