[aspectc-user] Definition collisions after weave
panu.bloigu at mbnet.fi
Fri Nov 3 13:48:29 CET 2006
Hello you all!
The situation I'm going to describe may seem like minor curiosity rather
than a real issue, but the principle behind it feels -- atleas to me -- kind
Let't say I have a class, say "ClassA", which has a method, say "void
method()", as it's member. Also let's say that ClassA has another member
named "void __exec_old_method()". Now, you probably guess where this is
going... If I want to have some aspect code executed before execution of
method()'s code, my C++ compiler gives me a compile time error. This happens
because the AspectC++ weaver adds a member "void __exec_old_method()" to
ClassA, which already has a similar member. So there will be two definitions
of the same method.
Like I said, this might seem like a non-issue to most, but doesn't this
violate the "obliviousness" goal of AOP, because one has to know what
methods she absolutely _can't_have_ as class members? As one gets familiar
with AspectC++, he gets to know this and soon learns to avoid certain naming
schemes in base code, but what if one has to add aspects to some base code
which just happens to include a colliding method definitions and there is no
way to change the existing base code? I'd like to hear what you all would do
in such a situation.
More information about the aspectc-user