[m-dev.] Module qualification of typeclass methods

Peter Ross peter.ross at miscrit.be
Wed Oct 31 19:47:09 AEDT 2001


Fergus wrote:
> On 30-Oct-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> > Our prototype system for interoperability with .NET objects maps each
> > object to a typeclass.
>
> I think you meant that it maps each .NET _class_ to a Mercury type class.
>
Sorry, I tend to switch between the two, class is correct.

> (When discussing these things, it helps to use precise language ;-)
>
> > Each of these typeclasses may have names which
> > conflict with the same name in another typeclass, hence we have to place
> > each typeclass in a seperate sub-module.  The mscorlib assembly has 883
> > public types in it, so a reasonable use of this library may require 20
> > or 30 imports just to use a subset of its types effectively.  I can
> > assure you that this is very annoying.
>
> Could you give an example?
>
> Note that having 20 or 30 imports is not uncommon for modules in the
> Mercury compiler directory.  I haven't found that to be particularly
> annoying.
>
Yes but each of those imports contains more functionality then just one
type.  Imagine if you had to do an import for each type in the prog_data
module that you wanted to use.

Actually there is two problems.  The first is that which I explained above.
The next is that not only do you need to do an import to use that type, but
if you want to use a method that the type has inherited from a parent class
you must also import the module which defines that parent class.  So to use
one type correctly you may need to import its whole inheritance hierachy.
This seems very inelegant to me.

An example is that I have to do 5 different imports just to run an SQL query
against a database.  I feel I should just do an :- import_module
System__Data.

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