[mercury-users] [petdr at miscrit.be: Report on the ICFP 2000 prog contest]

David Overton dmo at cs.mu.OZ.AU
Wed Sep 6 11:46:26 AEDT 2000


On Wed, Sep 06, 2000 at 10:57:17AM +1100, schachte at cs.mu.OZ.AU wrote:
> > It is instructive to note that one of the bugs that took the longest to
> > find was in the following code:
> > 
> >     inside_sphere(Point, Trans) :-
> > 	Point = point_to_object_space(Trans, Point),
> > 	mag2(Point) =< 1.0.
> 
> That's an interesting bug; it's such an easy mistake to make, and so
> hard to see.  The interesting thing about it is that the code doesn't
> say what you intended, but you *could* have intended what you wrote, so
> the language really can't find it for you.

One way this bug could have been avoided would be by using different
types for the object space points and world space points.

> Anyway, how did you try to debug it?  I would have thought the
> declarative debugger would have pinpointed it very quickly.

We didn't use the declarative debugger, but by using a similar process
to what the declarative debugger would have used, and by looking at
the kinds of errors occurring in the images produced, we quickly
worked out that the bug _had_ to be in that section of code (IIRC,
Fergus, Tom and myself all came to that conclusion independantly).
But the code looked so simple that we thought the bug couldn't
possibly be in here, even after staring at it for a very long time.
The bug was found by Rob, who came up to Tom and myself while we were
in the process of pulling our hair out.  He looked over our shoulders,
pointed at the relevant piece of code and said ``that can't be right,
you've used `Point' twice''.

So I guess the bug was found by the ``many eyes'' approach.


David
-- 
David Overton      Department of Computer Science & Software Engineering
PhD Student        The University of Melbourne, Victoria 3010, Australia
+61 3 8344 9159    http://www.cs.mu.oz.au/~dmo
--------------------------------------------------------------------------
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