On Sat, 10 Dec 2011, Nikodemus Siivola wrote:
> On 10 December 2011 12:15, Tamas Papp <tkpapp@...> wrote:
> > Redefining structures (with a different layout, or factoring out parts
> > to an included structure, etc) sometimes causes glitches like
> > The value
> > #S(AXIS
> > :TITLE "y"
> > :TITLE-MARGIN 20
> > :DECORATION-MARGIN #S(XY :X 25 :Y 45)
> > :MARK 3
> > :ANNOTATION-DISTANCE 6
> > :SPACING #S(XY :X 50 :Y 30))
> > is not of type
> > AXIS.
> > [Condition of type TYPE-ERROR]
> This is pretty much expected when redefining structures unless you're
> exceedingly careful.
> You have in your image instances of structures using the old layout,
> which then break when used with the new accessors and predicates.
> (Usual suspects include DEFVARs, LOAD-TIME-VALUEs, DEFGLOBALs, closed
> over values, EQL-specializers, and slots with :ALLOCATION :CLASS)
I thought about that, but I got this error even when I regenerated the
instances according to the new layout. Of course, I don't know how
deeply SBCL inlines the layout, so it could happen that I forgot to
recompile something, but I did an asdf reload and still got the error
> For things where allocation or slot access speed is not at premium
> (AXIS above doesn't look like it), you're propably better off using
> DEFCLASS, since it allows instances to be updated.
Speed is irrelevant per se in this application, I am using structures
because of the extremely nice read/write syntax (I guess one could
write a mixin class with some MOP magic to emulate this though, but am
not comfortable enough with the MOP just yet).
> You may also consider writing a DEFOBJECT that can expand to either
> DEFSTRUCT or DEFCLASS as needed, so that you can switch to DEFCLASS
> when you're working on the system, and DEFSTRUCT when deploying.
Great suggestion, I think I may end up doing that.