[m-rev.] for review: type_class_transformation.html

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Feb 27 15:56:52 AEDT 2004


On 27-Feb-2004, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> 
> compiler/notes/type_class_transformation.html:
> 	Undo Fergus's recent addition of a request for a pointer to the
> 	documentation of the proposed replacement for base_typeclass_infos,
> 	since that pointer already exists a few lines above.

Thanks.

> 	Document the mechanisms we use or should use for detecting duplicate
> 	instance declarations.

> +<H3> Detecting duplicate instance declarations </H3>
> +
> +We would like to catch duplicate instance declarations
> +(those that declare the same vector of possibly unground types
> +to be members of the same typeclass)
> +as early as possible.
> +Since duplicate declarations can occur in different modules,
> +the earliest practical time is link time.
> +We would therefore like to generate a name for the global variable
> +that holds the base_typeclass_info of an instance declaration
> +that depends only on the identity of the typeclass
> +and on the instance declaration's vector of argument types.
> +
> +For the C backends, this is what we actually do.
> +As a result, duplicate instance declarations will result in a link error
> +for a multiply defined symbol.

In practice this only works if you use static linking.
For dynamic linking, multiply defined symbols don't seem to cause
any warning or error, unless both definitions occur in the same component
(i.e. both in the same shared library or both in the main program).

Otherwise that looks good.

-- 
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-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list