Re: default-component-class slot normally gets clobbered
Richard M Kreuter <[email protected]>
| Newsgroups | gmane.lisp.cclan.general |
|---|---|
| Message-ID | <[email protected]> |
Gary King <[email protected]> writes: > On Jun 15, 2006, at 1:17 AM, Richard M Kreuter wrote: > >> While I don't find any uses of default-component-class by grepping >> around the .asds I have, that's not conclusive... > > I think that the amount of code to be written far outweighs the > amount of existing code and that this implies that backwards > compatibility can be sacrificed in the name of progress. Perhaps a > putative patch could include code to warn if any systems are found > that rely on the old behavior...? It's easy enough to warn in those cases where the proposed new behavior might possibly make a difference (any module whose default-component-class is bound and not nil at the end of reinitialize-instance). Unfortunately, if the system class is to have an initform for the default-component-class slot, then this warning will be issued at least for all direct instances of system, which means one such warning will be raised for nearly all systems. It's somewhat more aesthetic to have the system class have an initform there than not, as it's hardly obvious that the default-component-class slot is nearly always nil, and that the defaulting inside class-for-type is responsible the correct functioning of almost all extant systems. Although I raised the possiblity that the fix I proposed would break something, I did so only out of due diligence. Remember that it breaks only systems where somebody (a) deliberately added either a class with an initform for the slot or a method on one of the initializers to write the slot, and (b) never noticed that (a) had no effect. Is it possible? Is it likely? Is it worth caring about? The following is a patch that both emits the warning and supplies the initform for systems (and therefore emits the warning for every system). -- RmK diff -u /home/kreuter/lsp/pkg/cclan/asdf/asdf.lisp /home/kreuter/lsp/pkg/cclan/asdf/asdf.lisp.dcc1 --- /home/kreuter/lsp/pkg/cclan/asdf/asdf.lisp 2006-06-15 22:30:13.000000000 -0400 +++ /home/kreuter/lsp/pkg/cclan/asdf/asdf.lisp.dcc1 2006-06-15 23:07:57.000000000 -0400 @@ -242,7 +242,7 @@ :accessor module-if-component-dep-fails :initarg :if-component-dep-fails) (default-component-class :accessor module-default-component-class - :initform 'cl-source-file :initarg :default-component-class))) + :initarg :default-component-class))) (defgeneric component-pathname (component) (:documentation "Extracts the pathname applicable for a particular component.")) @@ -285,7 +285,8 @@ :accessor system-long-description :initarg :long-description) (author :accessor system-author :initarg :author) (maintainer :accessor system-maintainer :initarg :maintainer) - (licence :accessor system-licence :initarg :licence))) + (licence :accessor system-licence :initarg :licence) + (default-component-class :initform 'cl-source-file))) ;;; version-satisfies @@ -994,10 +995,19 @@ :parent parent other-args) (when (typep ret 'module) - (setf (module-default-component-class ret) - (or default-component-class - (and (typep parent 'module) - (module-default-component-class parent)))) + (if (and (slot-boundp ret 'default-component-class) + (not default-component-class)) + ;; This test and warning should go away eventually. + (when (and (module-default-component-class ret) + (not (typep ret 'system))) + (warn "Honoring default-component-class ~A of ~A.~%~ +ASDF versions prior to 1.98 always overwrote this slot during +system initialization." + (module-default-component-class ret) ret)) + (setf (module-default-component-class ret) + (or default-component-class + (and (typep parent 'module) + (module-default-component-class parent))))) (let ((*serial-depends-on* nil)) (setf (module-components ret) (loop for c-form in components Diff finished. Thu Jun 15 23:08:06 2006