Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-dev] Pointcut overloading

Taking the conservative side wrt language changes, I'd still want to see
a compelling reason for this feature, because it could add confusion.

Overloading of methods is a convenience intended to permit the method
to accomodate clients who don't want to provide all the parameters.  
(If used otherwise, it can introduce bugs, since methods of the same
name then mean different things.)  But for pointcuts, it is the supplier 
and not the client who provides the context.  That means overloading is 
either syntactic sugar or confusing.  I.e., given

  pointcut pc() : ...
  pointcut pc(Object o) : ...

syntactic sugar: if the join points picked out are exactly the same, 
then for the client, "pc()" is exactly the same as "pc(Object)", i.e.,

   before() : pc(Object) { ... }
   before() : pc() { ... }

(I prefer the first variant, which explicitly says, "I don't care about
the value, and I know what I'm doing.")

confusing: if the join points picked out differ, then (imho) the
pointcuts should not have the same name.  I don't think a programmer should
have to parse parameters to distinguish two pointcuts.  This looks like
what Josh Bloch called a bad language feature: one where an incorrect
program looks like a correct one (and the compiler can't detect the error).
The difference with methods is that it's the method which is in a position
to decide the behavior if the client doesn't have or care about a parameter;
for pointcuts, the parameters shouldn't affect the behavior of the pointcut
(imho).

(I'd also want to know what this meant for implementations and support,
e.g., for implementing dynamic/VM-based or extensible pointcuts, and for
supporting pointcut content assist, wizards, etc.)

That said, I have been annoyed by the no-overloading rule a couple times
(in, what, three years?); I ended up creating variants  like "init()" and
"init_manage(Foo foo)".

Wes

> ------------Original Message------------
> From: Eric Bodden <eric@xxxxxxxxx>
> To: aspectj-dev@xxxxxxxxxxx
> Date: Mon, Mar-21-2005 1:26 AM
> Subject: RE: [aspectj-dev] Pointcut overloading
>
>  
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I raised a feature request on this:
> 
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=88620
> 
> This one also explains the "contradiction" between the two requested
> features. At least I think that this is, what Gregor meant. Whoever
> is interested in welcome to contribute to the discussion there.
> 
> Eric
> 
> - -- 
> Eric Bodden
> Chair I2 for Programming Languages and Program Analysis
> RWTH Aachen University
> 
> -----BEGIN PGP SIGNATURE-----
> Version: PGP 8.0.3
> 
> iQA/AwUBQj6TCMwiFCm7RlWCEQKQ6ACfauFzgU1/14eDQyuQ/EFV7XUfi5UAoIsu
> MM4VsP/f5VyGj9o2CFpk5Mhi
> =ggK9
> -----END PGP SIGNATURE-----
> 
> 
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-dev
> 



Back to the top