[m-dev.] Foreign type compare and unification
Peter Schachte
schachte at cs.mu.OZ.AU
Tue May 21 12:59:23 AEST 2002
> I was talking about this yesterday with Mark. One idea was that we
> allow declarations of the form
>
> :- default_instance c(T) where [...].
>
> which would essentially make all types T an instance of type class c/1,
> and provide default method implementations (an explicit c(T') instance
> declaration for T' overriding the default_instance declaration for T.)
Sounds good to me.
I'd actually prefer, though, to allow class declarations to provide
default methods. If all methods of a class have defaults, then every
type could be an instance by default. This gets you the same
facility, but has the added advantage of supporting default methods
for ordinary classes, which seems like a useful feature.
> Mark objected that this would be bad in that the behaviour of a program
> could change if someone later added an explicit c(T') instance
> declaration.
True enough, but how much worse is that than the current state of
affairs in which adding an instance declaration in some unrelated
module in your application, or even just linking in a new library
module, can cause your application not to compile (actually, link) at
all?
--
Peter Schachte He that waiteth for all men to be satisfied with
schachte at cs.mu.OZ.AU his plan, let him seek eternal life, for he
www.cs.mu.oz.au/~schachte/ shall need it.
Phone: +61 3 8344 9166 -- Mark Twain
--------------------------------------------------------------------------
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