Testing one, two, three... Is this thing on?
AMOP sayeth about CLASS-PROTOTYPE: "Wheter the instance is initialized or
not is not specified."
(defclass foo ()
((bar :initarg :bar :initform (error "required initarg missing"))))
;; or equivalent behaviour by default-initargs or initialization
;; methods
Classes such as the above can then lead to problems: it would be legal for
an implementation to signal the "required ... missing" error for
(class-prototype (find-class 'foo))
Tightening the spec to guarantee that no user-supplied initialization code
(including initforms, default-initargs, and initialization methods) will
be executed by CLASS-PROTOTYPE would solve this, but at that point it
would seem both simpler and cleaner to specify an uninitialized instance.
That in turn could be relaxed to allow returning an instance previously
created by user code, but I've the feeling that this could create
problems, since it would make it unnecessarily hard for the user to
control the lifetime of his instances, leading to unnecessary garbage
being retained -- and the gain for allowing such seems rather small as
well.
Cheers,
-- Nikodemus "Not as clumsy or random as a C++ or Java.
An elegant weapon for a more civilized time."