On 3/16/10 7:17 AM, Helmut Eller wrote:
* 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.
Is there any reason why we couldn't replace at least these two places by %instance-ref?
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.
I did that already last night, just to see if did what I wanted. Seems to work. Ray