[m-dev.] Module qualification of typeclass methods

Peter Ross peter.ross at miscrit.be
Wed Oct 31 20:01:12 AEDT 2001


Fergus wrote:
> On 31-Oct-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> > The idea of different include_module is a good idea.  I intend to work
on it
> > today.
>
> OK, but I don't think we have any concensus on this yet.  So I don't
> think it would be a good idea to leap into implementation just yet.
> I presume you'll start by documenting the syntax and semantics of the
> new construct, and posting that for review?
>
> I have an alternative proposal, which was part of my original proposal
> for nested modules.  This proposal is to have a new construct
>
> :- export_module <module name>.
>
> which includes the *contents* of the specified module in the current
module.
> (Maybe `export_module' isn't the best name for it.
> Other possible names include `export_module_contents',
> `module_contents', `copy', and `include'.)
>
> When used in combination with include_module, it has the same effect
> as this proposal for a different include_module.  But it can also be
> used for other purposes, e.g. to rename modules, or to combine modules.
>
> % renaming a module:
> :- module new_name_for_foo.
> :- interface.
> :- export_module foo.
> :- end_module new_name_for_foo.
>

To make this clear:

:- module foo__bar.
:- export_module baz__bar__foo.
:- end_module.

Would replace all module qualifiers baz__bar__foo with foo__bar on the items
in baz__bar__foo.

> % combining two modules into a single module:
> :- module foo.
> :- interface.
> :- export_module bar.
> :- export_module baz.
> :- end_module foo.
>
I think this proposal would be very useful for solving a problem I am having
with the fact that a namespace in .NET can reside over more than one
assembly.

Pete

--------------------------------------------------------------------------
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