* Raymond Toy [2010-03-16 04:41+0100] writes:
I tried undefine-function-name instead of undefine-structure. It works, but having a redefined structure accessor that doesn't really work is a problem. For example,
(defstruct abc a) (defun abc-a (x) 42) (make-abc :a 'a) -> #S(abc :a 42)
This seems not good either.
default-structure-print calls (fdefinition (dsd-accessor slot)). We could change that to %instance-ref. That would also help in this case: (defstruct abc a) (fmakunbound 'abc-a) (make-abc :a 'a) -> error during printing Unfortunately, there are other places that call dsd-accessor by name. Like inspect.
Maybe disallowing redefining structure-accessors this way is the best; don't kill the structure, don't allow redefinition of the accessor either.
Sounds like a candidate for cerror. Helmut