I had a problem with the fact that the third-party library should act in the class, as if it were complete. After some reading, I understand the motivation for this mechanism, but I really don't know how it works.
Example:
(make-instance 'expression :op '+ :left 'nan :right 'nan) (defmethod normalize-expression ((this expression)) (optima:match this ((optima::or (expression :left 'nan) (expression :right 'nan)) 'nan) ((expression :op op :left x :right y) (funcall op xy))))
If I do not add the first line, the function will not compile, which will give me this error:
; caught ERROR: ; (during macroexpansion of (SB-PCL::%DEFMETHOD-EXPANDER NORMALIZE-EXPRESSION ...)) ; SB-MOP:CLASS-SLOTS called on
optima is a pattern matching library, (expression :op op ...) matches instances of the expression class by this pattern. I donβt know much details, but it looks like he should know what accessors are for this class, and it looks like this information is not available until it is complete. So, is there a way around the finalization problem?
The class will not be extended (at least not in this project, and it is not planned). It doesn't hurt to create a dummy instance ... it's just an ugly solution, so I was hoping to find the best. In addition, perhaps I will get additional information about the completion, which is also good :)
user797257
source share