|
From: | Eric Blake |
Subject: | Re: possible bug in TreeMap.sucessor implementation |
Date: | Sat, 21 Dec 2002 11:33:46 -0700 |
User-agent: | Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 |
Dalibor Topic wrote:
Since nil is supposed to have children that are also nil it appearsthat at some point nil.right was assiged a value.would it be possible to make nil an "ImmutableNode", so that such assignments are caught and greeted with an Error? that should make your life easier next time you have to debug a similar case.
For debugging, yes. For efficiency, no. Creating an ImmutableNode would require reworking the entire TreeMap class to use method calls, rather than field assignments, for manipulating nodes. Adding polymorphic calls is an additional layer of indirection, and will make the overall implementation slower.
I still haven't had a good look into the bug, but I have finally got the time to spend on it now, and have reproduced it. So look for a fix by the end of the day (I hope).
-- This signature intentionally left boring. Eric Blake address@hidden BYU student, free software programmer
[Prev in Thread] | Current Thread | [Next in Thread] |