Friday, September 8, 2006

DEFSETF misadventure

While working through some new unit-tests for Graphic-Forms, I happened to discover an assertion failure in an existing test occurring when I run the test more than once. Strangely, it happens on LispWorks and SBCL, but not CLISP. -- Drat! -- The failing assertion validates an attribute value set on a test layout manager (which is created anew every time the test runs), then a bit further on the test sets this attribute to a different value and checks it again. The failure scenario is on the second run. Right now, it looks like the 2nd value from the first run has persisted and that's why the assertion fails.

The culprit appears to be a `short form' DEFSETF defined in Graphic-Forms so application code can SETF attributes on layout managers. Or perhaps the culprit is an attribute setter function upon which the DEFSETF is implemented?

These layout manager attributes are stored in per-object lists; there is no global state in my code where these attributes are concerned. Perhaps there is some memoization being done behind the scenes? It's very puzzling.

No comments: