Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] if (false) pointcut and the empty set

> What about providing syntactic sugar and making empty() ...

Of course, users can do this now, which will help them migrate in
the future:

----

public class LibraryPointcuts {
    pointcut never();
    // and for later?
    // pointcut never() : if(false);
    private LibraryPointcuts() {}
}

----

btw, I prefer "never" to "empty" or "none" b/c thinking in terms
of "sets" of join points matched can be misleading.  Ron I believe
first publicly proposed "never" in

  http://dev.eclipse.org/mhonarc/lists/aspectj-dev/msg00506.html

Wes

Ron Bodkin wrote:
What about providing syntactic sugar and making empty() be the name for the empty pointcut?

Separately, I think the if(false) request is an optimization. There's a good analogy in Java itself; writing if(false) statement; is almost equivalent to writing nothing too. However, it too imposes some additional constraints on the code that will be optimized away, e.g.,
if(false) throw new UndeclaredCheckedException("this will be a compiler error");

Ron Bodkin
Chief Technology Officer
New Aspects of Security
m: (415) 509-2895


------------Original Message-------------
From: Jim Hugunin <lists@xxxxxxxxxxx>
To: aspectj-dev@xxxxxxxxxxx
Date: Fri, Sep-5-2003 8:55 AM
Subject: Re: [aspectj-dev] if (false) pointcut and the empty set

AspectJ has a mechanism for specifying that a pointcut matches nothing. You specify no body at all, i.e.
   pointcut pc();

There have been complaints that this is confusing to people because it looks too much like an abstract pointcut declaration. For 1.2, we will consider providing a guarantee that if(false) will always be optimized away as matching nothing; however, I'm always concerned about having two roughly equivalent ways of saying the same thing in a programming language.

-Jim


Dean Wampler wrote:

I don't understand the internals of ajc, but the error messages also indicate to me that "if (false)" still results in some sort of evaluation at all join points and hence it still imposes a lot of overhead during the build. True? If so, a way to really turn it off "completely" would be nice (or some sort of alternative mechanism ....)

dean

Macneil Shonle wrote:


Hi all,

This is a minor feature request, but something I'd like to see. Sometimes
I want to disable a pointcut in my development (essentially commenting it
out). I used to do this by making the pointcut be "if (false)" but this
creates errors for after advice when expection handlers are present:

<...>
Thanks,
Macneil



_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-dev


_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-dev




Back to the top