[aosd-discuss] Scope of AOP..
Pascal Costanza
pc at p-cos.net
Fri Apr 7 09:51:46 EST 2006
On 6 Apr 2006, at 22:11, Marc Eaddy wrote:
>> I would expect that modern runtime environments indeed
>> optimize such function calls away.
>>
>> In Java, I suspect that the logging method is roughly
>> implemented like this:
>>
>> static boolean loggingEnabled = true;
>>
>> public void log(String msg) {
>> if (loggingEnabled) {
>> System.out.println(msg);
>> }
>> }
>>
>
> I assume the implemention above is not using AOP. In that case,
> you'll end
> up with some concerns, e.g., logging, being implemented using OOP
> and some
> with AOP, e.g., tracing. Since both concerns are crosscutting, I'd
> like to
> use the same uniform AOP implementation for both. For example, I
> may want
> logging and tracing to both be disabled using the same flag, or I
> may want
> them to send messages to the same destination. Statement Annotations
> unifies homogeneous (tracing) and heterogeneous (logging) concerns
> because
> it allows both concerns to be implemented using the same unified AOP
> solution.
What makes logging and tracing so different that you think they have
to be implemented using different mechanisms?
>> With macros, you can achieve a similar effect. Here is a
>> similar macro in Common Lisp...
>
> My argument is the same. I'd like a unified solution for both
> logging and
> tracing, not one that uses macros and one that uses AOP. I'm not a
> Lisp/Scheme expert, so please correct me if it is possible to
> implement/modularize all crosscutting concerns using macros.
Probably not. If you are willing to enumerate the join points to be
captured by a pointcut by inserting annotations to all the relevant
places (join point shadows), then macros are probably sufficient. For
quantified pointcuts ("all setters in class xyz and all its
subclasses"), this probably won't work (except by using some low-
level hacks, like redefining defmethod, etc.). It seems to me that
your proposal doesn't support quantified pointcuts either, unless I
am missing something.
Pascal
--
Pascal Costanza, mailto:pc at p-cos.net, http://p-cos.net
Vrije Universiteit Brussel, Programming Technology Lab
Pleinlaan 2, B-1050 Brussel, Belgium
More information about the discuss
mailing list