[m-dev.] module system discussion

Simon Taylor stayl at cs.mu.OZ.AU
Mon Nov 26 16:36:33 AEDT 2001


On 22-Nov-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> I would really like to reach a consensus on this issue, could a decision
> be made at the Mercury meeting on Monday?  As this is quite important to
> the work I am doing on bringing the .NET port up to scratch.
> 
> I do believe that it is necessary to have one of either :- auto_import
> or :- import_package implemented.
> 
> I am happy with either alternative.  I believe that the auto_import
> mechanism should only be allowed to refer to sub-modules.
> 
> I am opposed to only implementing the :- include declaration, as I think
> that there are times when you don't want that behaviour. I hope I have
> highlighted when.  I have no objections to *also* implementing this
> declaration.

Here's a summary of the current proposals after that discussion.

1. `:- import_hierarchy' and `:- use_hierarchy'
	(formerly known as `:- import_package' and `:- use_package')

`:- import_hierarchy <module>' imports all modules in the hierarchy
rooted at <module>.

The name has changed because we might want to use `package' to mean a
(distributed) package of modules, rather than just any module and its
sub-modules.

There was general agreement that this proposal is worthwhile.

2. `:- transparent_module' and `:- include_transparent_module'
	(we can probably do better on the names)

`:- transparent_module' is a new variant of the `:- auto_import'
proposal, suggested by Tyson.

A transparent sub-module is defined using a `:- transparent_module'
declaration rather than a `:- module' declaration, or included
using an `:- include_transparent_module' declaration. A transparent
sub-module is always _used_ when the parent module is imported or used.

This is useful for qualifying the methods of typeclasses with the class
name without having explicitly to import the module (and lots of similar
ones) everywhere, and without having to import the entire hierarchy with
`:- use_hierarchy'.

I think Fergus was still a bit wary about this one.

3. The `:- include' proposal is still on the table.

I'm not sure whether it is still needed if we add `:- import_hierarchy'.

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