[mercury-users] abstract types.

Peter Schachte schachte at cs.mu.OZ.AU
Wed Jan 19 00:17:52 AEDT 2000


On Tue, Jan 18, 2000 at 02:04:38AM -0800, Ralph Becket wrote:
> > Perhaps it's time to allow separate
> > implementations of different modes of a pred/func?

It'd be nice.

> I agree that a facility for the latter would be useful.
> However, is it necessary for your code to use the same
> predicate for packing and unpacking?

Not necessary, but using the same function for packing and unpacking
allows you to pretend this function is just an ordinary constructor.
That means you can almost(*) write a drop-in replacement for an
existing type that's just much more efficient.  Besides, it allows you
to make other code multi-moded.

----------
(*)Only "almost" because you'd need to be able to customize how such
terms are treated by functor/3 and arg/3, and in some cases you'd need
the ability to declare a set of semidet functions to be mutually
exclusive and/or exhaustive [but let's not start that again...].

-- 
Peter Schachte                     The universe is full of magical things,
mailto:schachte at cs.mu.OZ.AU        patiently waiting for our wits to grow
http://www.cs.mu.oz.au/~schachte/  sharper.
PGP: finger schachte at 128.250.37.3      -- Eden Phillpotts 
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list