rpgoldman at sift.net
Thu Sep 22 03:37:32 UTC 2016
I was pretty surprised to read this in the latest draft of operation.lisp:
;; A memoizing way of creating instances of operation.
;; All operations MUST created through this function.
(defun make-operation (operation-class &rest initargs)
"This function creates and memoizes an instance of OPERATION-CLASS...."
This was pretty surprising to me, and is a change to the contract we
make with programmers. I have certainly written a lot of code that calls
MAKE-INSTANCE on operation classes.
Are you requiring this because you want to rely on EQ-testing? Or....?
If we want to require the use of MAKE-OPERATION, and rely on the
operations being interned, we should do something to make it more
apparent, and not have things quietly do something wrong, if this
assumption is violated.
E.g., we could have MAKE-OPERATION do something detectable before
invoking MAKE-INSTANCE on an operation type (e.g., it could pass
:make-operation t to MAKE-INSTANCE with the other initargs). Then if
MAKE-INSTANCE is called on an operation class *without* the magical
marker from MAKE-OPERATION, we catch it (in a :BEFORE method?) and we
throw an error, and indicate the need to call MAKE-OPERATION.
More information about the asdf-devel