Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: "Humane Pointcut Languages" [Was: Re: [aspectj-users] AW: Pointcuton a constructor with a custom @Annotation]

I agree completely. I've often said that AspectJ's pointcuts and type
patterns need a long form, rather like xpath has a long, functional style
one in addition to its dense, compact, and cryptic version, e.g., //title is
short for /self::node()/descendant-or-self::node()/child::title (in a simple
case, the short form is clearer, unsurprisingly!)

I could see a more functional non-positional syntax, e.g.,

signature annotatedConstructor : member-annotation(@MyAnnotation) &&
static-type(*) && method-name(new) && static-arguments(..);

pointcut callAnnotated() : call(annotatedConstructor);

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Dean Wampler
Sent: Thursday, April 20, 2006 2:04 PM
To: aspectj-users@xxxxxxxxxxx
Subject: "Humane Pointcut Languages" [Was: Re: [aspectj-users] AW:
Pointcuton a constructor with a custom @Annotation]

Ron Bodkin wrote:
> Dean, I think you mean call( @MyAnnotation *.new(..) ) (or just
> call(@MyAnnotation new(..))), since there's no return type for a
> constructor.
> ...
>   
Yes, I forgot about the extra "*" for the (invalid) return type that was 
in the expression. Need to get my glasses checked, I guess ;)

I've made mistakes like this occasionally in my own PC definitions 
(PCDs). The PCD language is very "dense" and requires careful inspection 
of any PC. Given a lot of recent discussion in the bloggosphere about 
"humane interfaces" (e.g., 
http://www.martinfowler.com/bliki/HumaneInterface.html), it would be 
interesting to consider a more verbose & humane PC language for AspectJ 
that could be used with the existing language. When you consider that a 
typical PCD, like most code, is written once and potential read many 
times, I would certainly use a more verbose language if it were available.

For example, Perl has more human-readable equivalents to its many 
cryptic "$..." variables. What if AspectJ's PC language had special 
symbols like the following:

$any_return       => "*" used for the return type
$any_arg           => "*" for any single method argument
$any_arglist       => ".."

etc.

Just a thought...

dean
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users




Back to the top