Why can't defstructs be redefined?
vibhu.mohindra at gmail.com
Mon Jul 11 19:53:32 UTC 2022
On 11/07/2022 19:41, Alan Ruttenberg wrote:
> Anyone know this area of the compiler? It's very frustrating during
Interesting. The rationale is performance apparently.
CLTL2: 19.2. How to Use Defstruct
whose last four paragraphs explain the reason. It concludes with:
"The defstruct feature is intended to provide ``the most efficient''
structure class. CLOS classes defined by defclass allow much more
flexible structures to be defined and redefined."
If you want flexibility, but also don't want to use classes instead of
structs everywhere, one solution may be to define your own defstruct
macro in some package that produces a class and functions/methods.
Import and use that defstruct during development, but switch over to the
real one when development ends (assuming you want its performance).
> Seems we ought to, at least, be able to blow away all
> traces of the defstruct, ignoring existing structures and redefine it.
CLTL2 above agrees in its last para,
"Programming environments are allowed and encouraged to permit defstruct
so it sounds like you'll have made ABCL better once your
structure-definition approach succeeds. Others on this list will know
more about this area and the errors you're seeing.
More information about the armedbear-devel