[m-dev.] Module qualification of typeclass methods

Peter Ross peter.ross at miscrit.be
Wed Nov 14 22:41:04 AEDT 2001


On Tue, Nov 13, 2001 at 08:14:24PM +1100, Fergus Henderson wrote:
> On 12-Nov-2001, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> > This `:- include' proposal doesn't solve the problem of
> > including all of the sub-modules of modules such as
> > extras/complex_numbers/complex_numbers.m,
> 
> Sure it does, just put an `:- include' declaration in the parent module
> that includes the appropriate child modules.
> 
> Note that although in this particular case that means all child modules,
> in general you might often want to do this for just a subset of the child
> modules.
> 
I don't think it does solve the problem.  You stated before that an
export_module declaration will override the namespace qualifiers with
that of the current module, so for every sub-module you include using
this mechanism will lose its sub-module qualifier.  Probably leading to
name conflicts, which is the reason why you put it an item in a
sub-module in the first place.

Could someone please comment on what the following sentence means in the
Reference manual.

  If an `:- include_module' declaration occurs in the interface section of
  a module, then only the declarations (interfaces) of the sub-modules are
  included in the parent module's interface; the definitions
  (implementations) of the sub-modules are considered to be implicitly
  part of the parent module's implementation. 

I think it means that any definitions of the sub-module are visible when
the parent modules definitions are visible.  It sounds like it should
do what we want, but I know that it doesn't.

So I propose that we overload the meaning of an `:- include_module'
which appears in the interface section of a module to mean that you
should also automatically import that module.  Note that I think that we
should still keep the restriction that an `:- include_module'
declaration can only refer to sub-modules, however it can refer to
nested sub-modules not just seperate sub-modules.

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