I think the divergence is coming from the fact that I want a special functionality (package renaming) with a simple syntax and you want a general functionality which cannot be represented by a simple syntax. So it is a tradeoff between simple syntax and general functionality.

As package renaming is already available in a "complex" way, providing another complex way won't improve on its popularity. If it would be possible just with a few more characters in an asd file, people might use it. Otherwise if they have to create different functions, classes in separate files for that, they just keep providing nicknames...

But I am wondering how an asd file would look like with your scenario. Can you provide an example?

Btw, I imagine before/after implemented in a setup/cleanup style, so if compilation fails, cleanup (after) still runs. So it is wrapped in an unwind-protect.
So the before/after is nothing to do with generic functions in my view. It is just a wrapping around COMPILE-FILE.

`bg`


2011/10/17 Faré <fahree@gmail.com>
> (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)