[mercury-users] Mercury Modes Problem

Mark Brown dougl at cs.mu.OZ.AU
Mon May 27 11:34:23 AEST 2002


On 27-May-2002, Michael Day <mikeday at bigpond.net.au> wrote:
> 
> > Perhaps you consider this to be a "killer" for your application?  I hope
> > not.  Personally, I would recommend programming in this style rather
> > than use partially instantiated data structures, even though this may
> > make your code more verbose and probably less efficient, at least in the
> > short term.  I'd do this for essentially the same reason that I'd
> > discourage the use of difference lists in languages that support them.
> 
> Can you expand on that? Just it seems rather pointless for anyone to
> bother implementing partially instantiated data structures if their use
> will be discouraged. Might as well have done with partial instantiation
> altogether and simplify the mode system...

We haven't implemented partially instantiated data structures!  The mode
language is capable of expressing them, but that is a different matter.
The fact that the mode language is expressive enough opens the way for
*limited* support for them in future, but this in no way implies that a
fully general implementation is planned.

Incidentally, the debate about Prolog-style variables in Mercury is an
old one.  Try searching the archives.

As for why I'd discourage difference lists: they aren't consistent with the
usual intuitions that programmers seem to have about them.  When I first
heard of them, they were regularly touted as a "replacement" for normal
lists for which append could be implemented more efficiently.  But as my
Logic Programming Techniques lecturer wisely pointed out, they cannot be
used in the same way as lists.  For example, you can only append one
suffix to a difference list; unlike lists, later attempts to append a
different suffix will fail.

For the record, I haven't heard anyone tout difference lists for a long
time.

Cheers,
Mark.

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