[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CLOS style

I'd like to see some more discussion on CLOS style, esp with
regard to choice of :before, :after, :around, or primary methods.

I'm writing a large number of mixins. They have to co-exist with
lots of classes I can't even anticipate. A good style convention
would be of great help on deciding when to use :before, :after,
primary, or :around methods.

So far, I've been using :before and :after methods in preference to
specializing primary methods, that allows someone to choose not to
call-next-method when they specialize the primary & still get the
benefits (banes) of my :before & :after methods.

The disadvantage I see with :before & :after methods is that there
is no way to define a class that stops them (or a particular one)
from executing.

I specialize primary methods in preference to using :around methods.
I find you have to be carful with :around methods because if a function
late in the inheritance list has an :around method, it will get called
1st, unless some other :around method is called. This can be used to
your advantage sometimes.

In general, I'm finding I need to fully document my methods, and hope
my users read the docs carfully. It would be nice if there was some
sort of convention I could lean on. 

Does the MCL object lib have a convention on method type choice. I get
the impression it mainly consists of primary methods (& call-next-methods).
I assume, this is because that was the most straightforward to port the
MACL 1.32 code.