Didier Verna <didier.verna@...> writes:
> So how is it that with a slot type of fixnum, things still work, even if
> by accident?
Well, "work". Fixnum structure slots are optimized, but their
optimized representation is still tagged, so if you manage to store
something that's not a fixnum in there you will get it back unchanged,
as no tagging or untagging will be done at any point.
That's not all there is to it, though; not only is there no need to
tag an entry stored in a fixnum structure slot, there's no need to
consider it as a possible pointer: I put "work" in scare quotes above
because it will probably be OK until the float (or other
non-immediate object) that you put in there is GCed, at which point you will
probably crash the lisp. So don't do that.
The reason that a single-float structure slot is different immediately
is that the representation in the slot is untagged, so the underlying
representation is different from the tagged lispobj, and is therefore
always retagged on access.