[m-dev.] For review: Add implementation of reference types (global heap)

Peter Schachte pets at students.cs.mu.OZ.AU
Wed Jun 10 16:49:29 AEST 1998


On Wed, 10 Jun 1998, David Glen JEFFERY wrote:

> Personally, I'm not convinced that we should allow polymorphic equivalence
> types with monomorphic definitions at all. I don't think that the "equivalence"
> makes sense.

That's a good argument in most cases.  The only exception I can think of is
where the type is what I would call opaque or completely abstract to all
Mercury modules.  For example, array(T).  It *has* to be a polymorphic, but
there's nothing sensible you can put in a mercury definition of it.
Ultimately, you have to punt to C code to handle any operation that needs to
look "inside" an instance of the type, so you don't want your mercury code
to think it can look inside it. 

This is yet another argument for the feature I'm asking for:  it'll allow
you to change the "missing feature" message into a proper error message.

BTW, if you really don't want to allow a type declaration without a
corresponding type definition, then you could allow syntax like

	:- type array(T) is opaque.
and
	:- type array(T) is opaque where equality is ....

(or use `abstract' or even `foreign' or something along those lines).


-Peter Schachte               | We hang the petty thieves and appoint the
mailto:pets at cs.mu.OZ.AU       | great ones to public office.
http://www.cs.mu.oz.au/~pets/ |     -- Aesop 
PGP: finger pets at 128.250.37.3 | 




More information about the developers mailing list