You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

language.adoc 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. = AspectJ Language Design
  2. == User-suggested New Language Features
  3. * `-` wildcard
  4. ** https://dev.eclipse.org/mhonarc/lists/aspectj-dev/msg00717.html
  5. ** https://bugs.eclipse.org/bugs/show_bug.cgi?id=34054#c2
  6. * Class cast pointcut
  7. ** https://dev.eclipse.org/mhonarc/lists/aspectj-users/msg01479.html
  8. * Extensible pointcuts, abstract pointcuts, and interfaces
  9. ** https://dev.eclipse.org/mhonarc/lists/aspectj-dev/msg00458.html
  10. ** https://dev.eclipse.org/mhonarc/lists/aspectj-dev/msg00467.html +
  11. == Key Language Design Properties
  12. === Orthogonal join point model
  13. The different kinds of join
  14. points, the different primitive pointcuts, and the different kinds of
  15. advice can be used in any combination.
  16. This was one of the hardest parts of the design to get right, because of
  17. the "constructor must call super" rule in Java. But we finally got this
  18. in 1.0.
  19. === Pointcuts support composition and abstraction
  20. Abelson and Sussman
  21. say that composition and abstraction are the key elements of a real
  22. language. Clearly the pointcut mechanism is the new thing in AspectJ,
  23. and so it was critical that it support composition and abstraction. The
  24. fact that someone can write:
  25. [source, java]
  26. ----
  27. /* define an abstraction called stateChange */
  28. pointcut stateChange(): call(void FigureElement+.set*(*));
  29. /* compose pointcuts to get other pointcuts */
  30. pointcut topLevelStateChange(): stateChange() && !cflowbelow(stateChange());
  31. ----
  32. is what makes it possible for people to really work with crosscutting
  33. structure and make their code more clear.
  34. === Statically type checked
  35. The efficiency, code quality and programmer
  36. productivity arguments for this have been made elsewhere, so I won't
  37. repeat them.
  38. === Efficient
  39. AspectJ code is as fast as the equivalent functionality,
  40. written by hand, in a scattered and tangled way.
  41. === Simple kernel
  42. I've heard some people say that AspectJ is too big
  43. and too complex. In the most important sense of simple AspectJ is
  44. simple. I can reason about any AspectJ program with a simple model. The
  45. kernel of AspectJ is simple, and the orthogonality described above means
  46. that its easy to start with just the kernel and slowly add to that.
  47. Its pretty clear to pull out this kernel of AspectJ. I would argue that
  48. the right idea for a standard AOP API
  49. is this kernel, packaged in a way that allows building more
  50. sophisticated tools on top of it.
  51. === Supports multiple weave times
  52. AspectJ is neutral on whether weaving
  53. happens at pre-process, compile, post-process, load, JIT or runtime.
  54. This neutrality is critical. Its why there are serious JVM experts who
  55. are already thinking about JVM support for AspectJ.
  56. There's more, but I think these are the most important ones. I think any
  57. functionality this group comes up with should also meet these
  58. criteria.