[m-dev.] dummy types with user-defined equality/comparison

maclarty at cs.mu.OZ.AU maclarty at cs.mu.OZ.AU
Mon May 29 17:22:16 AEST 2006


On Mon, May 29, 2006 at 05:09:09PM +1000, Julien Fischer wrote:
> 
> Currently the compiler will abort when confronted with a dummy type that has
> user-defined equality or comparison.  Below are two proposals for fixing
> this.  Which do people prefer?
> 
> (1) Change the reference manual to say that discriminated union types
>     whose body consists of a single zero-arity constructor may not have
>     user-defined equality or comparison defined upon them.  (Plus change
>     the compiler to emit the appropriate error mesages.)
> 

I think this option is best, since if values of the type are restricted
to one zero-arity function symbol then any two values of the type must
compare as equal for all sound definitions of equality and comparison.

> (2) Change the compiler so that it does not treat discriminated union types
>     whose body consists of a single zero-arity constructor as dummy types.

I thought that was how the compiler recognised dummy types.  Are you
proposing to get rid of dummy types altogether?

Ian.
--------------------------------------------------------------------------
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