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

Peter Schachte pets at students.cs.mu.OZ.AU
Wed Jun 10 12:10:48 AEST 1998


On Wed, 10 Jun 1998, Thomas Charles CONWAY wrote:
> Peter Schachte, you write:
> > So why not allow a type to be defined abstractly, with no concrete type
> > declaration at all, and only complain if some attempt is made to "look
> > inside" an instance of that type?  This seems more in keeping with the
> > overall style of Mercury. 
> 
> You can't tell if someone will look inside it or not very easily. You can't
> tell until link time if someone tries to pass it to write for instance.
> Just waiting for a link error if someone generates a reference to the
> typeinfo for the type isn't all that good (I think this is the current
> behaviour).

I think it would be quite reasonable to supply a "dummy" type info for such
abstract types that treat them similarly to the way integers are treated
(basically the way you'd want to treat a void *).  Treat them like
c_pointers.  In fact, assign all such types the same typeinfo as is used for
c_pointer. 

Now that I think about it, maybe I'm suggesting replacing the c_pointer type
with a new concept of totally abstract type.  This would avoid the problem
that the name of the type basically gets lost when you define a type as
"==c_pointer."  And, of course, avoid that bug such definitions tickle in
the Mercury compiler. ;-)


-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