You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Actually, now that I'm looking at this code, I can see that it's quite, quite broken. The reason for the guards was because fixup_neighbor() was called on all of self's neighbors, and that fixup_neighbor() had to figure out which neighbor was being fixed up. That is really a poor way of doing it as each if statement already knows which neighbor its working on, so fixup_neighbor() is unnecessary.
That said, this does give a good opportunity to put in some debug asserts; our children should see us as their parent, and our parent should see us as their child. If these invariants are ever broken, then so is the tree.
Actually, now that I'm looking at this code, I can see that it's quite, quite broken. The reason for the guards was because
fixup_neighbor()
was called on all ofself
's neighbors, and thatfixup_neighbor()
had to figure out which neighbor was being fixed up. That is really a poor way of doing it as eachif
statement already knows which neighbor its working on, sofixup_neighbor()
is unnecessary.That said, this does give a good opportunity to put in some debug asserts; our children should see us as their parent, and our parent should see us as their child. If these invariants are ever broken, then so is the tree.
Originally posted by @ckaran in #54 (comment)
The text was updated successfully, but these errors were encountered: