[m-dev.] module system discussion

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Nov 29 22:08:32 AEDT 2001


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.

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.

Now, you may not like this solution, and it is not 100% identical
to what transparent sub-modules would give you.  But I think it is a
quite reasonable solution, even if it does not deliver 100% of what you
might want, and it has the very big advantage that it works without
any need for a language extension.

The words of a Rolling Stones song come to mind...

	you can't always get what you want
	you can't always get what you want
	but if you try some time
	you just might find
	you get what you need

;-)

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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