[m-rev.] for review: priority search queue ADT

Paul Bone paul at bone.id.au
Wed Nov 26 11:33:43 AEDT 2014


On Mon, Nov 24, 2014 at 12:02:08PM +0100, Matthias Güdemann wrote:
> >> Note, that the sequence of priority and keys is only changed for the
> >> interface; in the implementation, both the internal type representation
> >> and view types have not been changed.
> >
> > What is the reason for not changing this?  If they have the same argument
> > order then someone who modifies the psqueue code at some latter time will be
> > able to learn how the code works more easily if it matches the interface
> > they have already learnt.
> 
> The original order Key, Priority is used throughout the cited paper,
> in particular for the internal view types. Therefore someone who
> consults the paper. e.g., for fixing s.th. in the code, will have an
> easier task.

I don't mean to say that the paper isn't valuable, far from it, but I don't
think it should be part of Mercury's documentation.  If someone wants to
knwo how this works the source code and comments should be the only
documentation that they need.  The reference to the paper is still important
for attribution.

> 
> My main motivation for changing the order in the type signature and
> interface was to have it homogenous with the order in pqueue. Without
> this, if s.o. would replace pqueue with psqeue and not adapt the
> argument order, there would be no type error or warning, but the
> result would be wrong.

When I read one of your earlier e-mails (3 emails ago?) I had my doubts
about this decision, but after your second last e-mail I changed my mind and
agree with you that 1) consistency with pqueue is important and 2) that
psqueue(P, K) makes sense.

Thanks.


-- 
Paul Bone



More information about the reviews mailing list