[m-dev.] Module qualification of typeclass methods

Tyson Dowd trd at cs.mu.OZ.AU
Tue Nov 20 17:56:31 AEDT 2001


On 20-Nov-2001, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> On 20-Nov-2001, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> > I think it is still valuable to have the full name of an object
> > 
> > 	Name = 'System__ServicedComponent__DisposeObject'(O)
> > 
> > used when appropriate.  And it would still be annoying to have to 
> > add the import_module for it when I want to do this. 
> 
> I see your point.
> 
> The only real difference between `:- include' and `:- auto_import'
> is that `:- include' renames the items from the included module and
> `:- auto_import' doesn't.
> 
> `:- include' is better where you want to treat the included modules
> as a single unit, so losing the module qualifiers is actually an
> advantage (e.g. extras/complex_numbers).
> 
> `:- auto_import' is better for small sub-modules introduced for a
> typeclass so that the class methods can be qualified with the class
> name, but where the class is logically part of the parent module.

Yes.  This seems to be the case.  (nice summary too!).

The confusion seems to come when we discuss both cases at the same time.

> A lot of the discussion so far has been concerned with using
> `:- include' to achieve something that is better done using
> `:- auto_import'. They can be considered to be minor variations
> of the same feature, so why can't we just support both?

I think this is probably what we are going to have to do.

However, one should then consider -- what is :- include then?
Is it just :- auto_import + renaming (where I think of renaming as some
kind of lightweight forwarding mechanism)?

If so, perhaps we should define a renaming feature instead of :- include,
and then consider whether :- include is still necessary.  

It might be that it is good to keep the :- include syntax but define it
in terms of renaming and auto_import. 
Or perhaps the include syntax is no longer required because renaming
does the job just fine. 
Or perhaps we should define the concept of renaming and *define* 
:- include using it, but not actually bother to implement it.
Or perhaps we should go for the monolithic feature approach, and just
say what :- include does, and then we have freedom to implement it as we
wish.

-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
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