(defsystem com.host.my-system (:serial t) (:depends-on ("system-1" "system-2") (:components ((:file "file1") (:file "file2" :class 1) (:file "file3" :class 2) (:file "file4" :class 1)) (:before-compile 1 #'(lambda (component) (do what you want))) (:after-compile 1 #'(lambda (component) (do what you want)))))
Once again, :around compile is more general than :before and :after, and some of its functionality (e.g. binding, condition handling, unwind-protect, result filtering, etc.) just cannot be properly achieved with :before and :after methods.
Also, some files may need special handling. For instance, the file that defines packages and/or helpers for a :around-compile function must not be wrapped by the function that depends on it. So it is not practical to have a system-wide default that cannot be overridden.
And class 0 could be the (unspecified) default. However, I would still prefer to have some kind of simplified notation for the local package renaming functionality as I think that is the most common. And I have no idea how difficult it is to put something like this into asdf as I am not familiar with its code...
I don't see how the numbering helps. Let's keep it with named classes when needed.
As to how I'd implement it: I'd add an around-compile slot to component, with no :initform, an effective-around-compile generic function that handles "inheritance" from the parent when the slot is unbound, a (call-with-around-compile-hook component thunk) that does the wrapping based on the former gf, and use that use that function in the perform method for compile-op.
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org Mathematics is the Queen of Science but she isn't very Pure; she keeps having babies by handsome young upstarts and various frog princes. — Donald Kingsbury (In "psychohistorical crisis", 2001)