To: demgr-students Subject: new pointcuts From Gregor Kiczales: > ... >You are using _ in various places. >It looks like that is to mangle generated names. >But is that really part of the specification? >This kind of problem is one of many >good reasons to NOT describe what "declare traversal" >does as generating code, but to >instead describe it in terms of what it defines the programmer can count on. To address Gregor's (also shared by Doug and Mitch), we need to add new AspectJ pointcut designators: Here is a proposal from our seminar today: Proposed new declaration: declare traversal trav = "traversal strategy"; Example: declare traversal trav = from r:R via s:S to t:T; Proposed new pointcuts for AspectJ: For node visits: visiting(trav, S s) traversal trav is visiting an S-object For edge crossings: crossing(trav, C c, "x", Object open) traversal trav crosses edge from c through field "x" to open crossing(trav, C c, "x", D d) traversal trav crosses edge from c through field "x" to d crossing(trav, C c, String open, D d) traversal trav crosses edge from c through field open to d There are 8 different kinds of crossings as described in: http://www.ccs.neu.edu/home/lieber/com1205/w01/materials/html/alpha.html Traversal variables of trav will also be visible in advice involving traversal trav. For example, in advice using the pointcut visiting(trav, T o1), variables r, s and t will be visible and set. If we don't add new pointcuts, the pointcuts get too long: http://www.ccs.neu.edu/research/demeter/seminar/2002/jan24/pengcheng/Total.java this(c) && withincode(* Company.t_admin(..)) && target(ad) && call(* t(..)) is much longer than: crossing(t, Company c, admin, Object ad) I guess an alternative would be: traversal(trav) && crossing(C c, "x", D d) instead of crossing(trav, C c, "x", D d) Is crossing(C c, "x", D d) in itself useful as a pointcut? -- Karl