[m-dev.] Associating insts with types

Ralph Becket rafe at cs.mu.OZ.AU
Wed Jul 21 17:33:19 AEST 2004


Consider the hash_table type in the library.  Its definition includes
a user-supplied hashing predicate, so neither ground nor unique are
sufficient information to make a hash_table value to work: the
implementation has to know the mode of the embedded predicate.

But hash_table is an abstract type: the user of a hash_table should only
care whether a value is free, ground or unique.  However, currently we
have to pass around such values using the artificial modes
hash_table_{di,ui,uo}, precluding their use with other library
predicates.

It seems to me that we could add an optional type attribute:

:- type t ... where ground is <inst>.

The effect of this would be to cause the compiler to interpret `ground'
as <inst> for t values.

I think this would be fairly easy to implement and it doesn't strike me
as an unpleasant hack.

Can anyone see any moral or practical problems with this idea?

-- Ralph
--------------------------------------------------------------------------
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