[m-dev.] module system discussion

Peter Ross peter.ross at miscrit.be
Tue Dec 4 01:04:13 AEDT 2001


On Fri, Nov 30, 2001 at 07:39:14PM +1100, Simon Taylor wrote:
> On 29-Nov-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > On 27-Nov-2001, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> > > > Simon wrote:
> > > > > 2. `:- transparent_module' and `:- include_transparent_module'
> > > 
> > > I thought it would be very useful for all those little subclasses that
> > > one needs to create in order to map a bunch of classes in a namespace
> > > into a mercury module.
> > > 
> > > Each of these little subclasses could be put inside a transparent
> > > subclass.  That way if you imported or used the parent module (say,
> > > System__Data) you would get all the transparent submodules automatically
> > > "used".
> > 
> > Another approach that would achieve a somewhat similar effect to this
> > without any language extension would be to have the interface tool
> > for .NET classes use prefixes such as `ClassName::' in the generated
> > predicate names for .NET class methods, rather than using sub-modules.
> > Sub-modules would then only be used for .NET namespaces.
> 
> I'm not proposing the `:- transparent_module' extension just
> for .NET. I am arguing that it is generally good style to qualify
> class method names with the class name, and that it is worth adding
> a small extension to the module system to make that more convenient.
> This hasn't come up before because we haven't used typeclasses much
> before, and especially not in large module hierarchies.
>  
I can live without this change but I still think that it is a good idea.
It appears that Simon, Tyson and I are in support of it and only Fergus
against it.  So I suggest that we accept my patch and start using it.

> > So the `Length' member of the `Constraint' class in the `System.Data'
> > namespace would be written as 'System__Data__Constraint::ToObject'
> > in Mercury.
> > 
> > Now when you import the parent module `System__Data', you automatically
> > import everything from the `Constraint' class, since the members of
> > that class are not a sub-module, they're just ordinary members of the
> > `System__Data' module with a special prefix.
> 
> Having to 'quote' every class method call is ugly enough that it's
> not an acceptable solution to me.
> 
I played with this approach at the start and you are right it is ugly.
These qualifiers look like namespace qualifiers so it feels wrong to
hack them onto the names.

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