Skip to main content

Effective Aspects: A Typed Monadic Embedding of Pointcuts and Advice

  • Chapter
Book cover Transactions on Aspect-Oriented Software Development XI

Part of the book series: Lecture Notes in Computer Science ((TAOSD,volume 8400))

Abstract

Aspect-oriented programming (AOP) aims to enhance modularity and reusability in software systems by offering an abstraction mechanism to deal with crosscutting concerns. However, in most general-purpose aspect languages aspects have almost unrestricted power, eventually conflicting with these goals. In this work we present Effective Aspects: a novel approach to embed the pointcut/advice model of AOP in a statically typed functional programming language like Haskell. Our work extends EffectiveAdvice, by Oliveira, Schrijvers, and Cook; which lacks quantification, and explores how to exploit the monadic setting in the full pointcut/advice model. Type soundness is guaranteed by exploiting the underlying type system, in particular phantom types and a new anti-unification type class. Aspects are first-class, can be deployed dynamically, and the pointcut language is extensible, therefore combining the flexibility of dynamically typed aspect languages with the guarantees of a static type system. Monads enables us to directly reason about computational effects both in aspects and base programs using traditional monadic techniques. Using this we extend Aldrich’s notion of Open Modules with effects, and also with protected pointcut interfaces to external advising. These restrictions are enforced statically using the type system. Also, we adapt the techniques of EffectiveAdvice to reason about and enforce control flow properties. Moreover, we show how to control effect interference using the parametricity-based approach of EffectiveAdvice. However, this approach falls short when dealing with interference between multiple aspects. We propose a different approach using monad views, a recently developed technique for handling the monad stack. Finally, we exploit the properties of our monadic weaver to enable the modular construction of new semantics for aspect scoping and weaving. These semantics also benefit fully from the monadic reasoning mechanisms present in the language. This work brings type-based reasoning about effects for the first time in the pointcut/advice model, in a framework that is both expressive and extensible; thus allowing development of robust aspect-oriented systems as well as being a useful research tool for experimenting with new aspect semantics.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. In: Proceedings of the 11th Workshop on Foundations of Aspect-Oriented Languages (FOAL 2012), Potsdam, Germany. ACM Press (March 2012)

    Google Scholar 

  2. Aldrich, J.: Open modules: Modular reasoning about advice. In: Gao, X.-X. (ed.) ECOOP 2005. LNCS, vol. 3586, pp. 144–168. Springer, Heidelberg (2005)

    Chapter  Google Scholar 

  3. In: Proceedings of the 7th ACM International Conference on Aspect-Oriented Software Development (AOSD 2008), Brussels, Belgium. ACM Press (April 2008)

    Google Scholar 

  4. In: Proceedings of the 9th ACM International Conference on Aspect-Oriented Software Development (AOSD 2010), Rennes and Saint Malo, France. ACM Press (March 2010)

    Google Scholar 

  5. Bagherzadeh, M., Rajan, H., Leavens, G.T., Mooney, S.: Translucid contracts: Expressive specification and modular verification for aspect-oriented interfaces. In: Proceedings of the 10th ACM International Conference on Aspect-Oriented Software Development (AOSD 2011), Porto de Galinhas, Brazil. ACM Press (March 2011)

    Google Scholar 

  6. Dantas, D.S., Walker, D.: Harmless advice. In: Proceedings of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2006), Charleston, South Carolina, pp. 383–396. ACM Press (January 2006)

    Google Scholar 

  7. Dantas, D.S., Walker, D., Washburn, G., Weirich, S.: AspectML: A polymorphic aspect-oriented functional programming language. ACM Transactions on Programming Languages and Systems 30(3), Article No. 14 (May 2008)

    Google Scholar 

  8. De Fraine, B., Südholt, M., Jonckers, V.: StrongAspectJ: flexible and safe pointcut/advice bindings. In: AOSD 2008 [3], pp. 60–71

    Google Scholar 

  9. Douence, R., Fradet, P., Südholt, M.: Trace-based aspects. In: Filman, R.E., Elrad, T., Clarke, S., Akşit, M. (eds.) Aspect-Oriented Software Development, pp. 201–217. Addison-Wesley, Boston (2005)

    Google Scholar 

  10. Douence, R., Motelet, O., Südholt, M.: A formal definition of crosscuts. In: Matsuoka, S. (ed.) Reflection 2001. LNCS, vol. 2192, pp. 170–186. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  11. Dutchyn, C., Tucker, D.B., Krishnamurthi, S.: Semantics and scoping of aspects in higher-order languages. Science of Computer Programming 63(3), 207–239 (2006)

    Article  MATH  MathSciNet  Google Scholar 

  12. Figueroa, I., Tabareau, N., Tanter, É.: Taming aspects with monads and membranes. In: Proceedings of the 12th Workshop on Foundations of Aspect-Oriented Languages (FOAL 2013), Fukuoka, Japan, pp. 1–6. ACM Press (March 2013)

    Google Scholar 

  13. Figueroa, I., Tanter, É.: A semantics for execution levels with exceptions. In: Proceedings of the 10th Workshop on Foundations of Aspect-Oriented Languages (FOAL 2011), Porto de Galinhas, Brazil, pp. 7–11. ACM Press (March 2011)

    Google Scholar 

  14. Figueroa, I., Tanter, É., Tabareau, N.: A practical monadic aspect weaver. In: Proceedings of the 11th Workshop on Foundations of Aspect-Oriented Languages (FOAL 2012), pp. 21–26 (2012)

    Google Scholar 

  15. Hilsdale, E., Hugunin, J.: Advice weaving in AspectJ. In: Lieberherr, K. (ed.) Proceedings of the 3rd ACM International Conference on Aspect-Oriented Software Development (AOSD 2004), Lancaster, UK, pp. 26–35. ACM Press (March 2004)

    Google Scholar 

  16. Hofer, C., Ostermann, K.: On the relation of aspects and monads. In: Proceedings of AOSD Workshop on Foundations of Aspect-Oriented Languages (FOAL 2007), pp. 27–33 (2007)

    Google Scholar 

  17. Jones, M.P.: Type classes with functional dependencies. In: Smolka, G. (ed.) ESOP 2000. LNCS, vol. 1782, pp. 230–244. Springer, Heidelberg (2000)

    Chapter  Google Scholar 

  18. Kiczales, G., Hilsdale, E., Hugunin, J., Kersten, M., Palm, J., Griswold, W.G.: An overview of aspectJ. In: Lindskov Knudsen, J. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 327–353. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  19. Kiczales, G., Lamping, J., Mendhekar, A., Maeda, C., Lopes, C.V., Loingtier, J.-M., Irwin, J.: Aspect-oriented programming. In: Akşit, M., Matsuoka, S. (eds.) ECOOP 1997. LNCS, vol. 1241, pp. 220–242. Springer, Heidelberg (1997)

    Chapter  Google Scholar 

  20. Learn you a haskell website (2013), http://learnyouahaskell.com/

  21. Leijen, D., Meijer, E.: Domain specific embedded compilers. In: Ball, T. (ed.) Proceedings of the 2nd USENIX Conference on Domain-Specific Languages, pp. 109–122 (1999)

    Google Scholar 

  22. Liang, S., Hudak, P., Jones, M.: Monad transformers and modular interpreters. In: Proceedings of the 22nd ACM Symposium on Principles of Programming Languages (POPL 95), San Francisco, California, USA, pp. 333–343. ACM Press (1995)

    Google Scholar 

  23. Hansen, K.A., Kawauchi, K.: Dataflow pointcut in aspect-oriented programming. In: Ohori, A. (ed.) APLAS 2003. LNCS, vol. 2895, pp. 105–121. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  24. Hansen, K.A., Kiczales, G., Dutchyn, C.: A compilation and optimization model for aspect-oriented programs. In: Hedin, G. (ed.) CC 2003. LNCS, vol. 2622, pp. 46–60. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  25. Masuhara, H., Tatsuzawa, H., Yonezawa, A.: Aspectual Caml: an aspect-oriented functional language. In: Proceedings of the 10th ACM SIGPLAN Conference on Functional Programming (ICFP 2005), Tallin, Estonia, pp. 320–330. ACM Press (September 2005)

    Google Scholar 

  26. Meuter, W.D.: Monads as a theoretical foundation for aop. In: International Workshop on Aspect-Oriented Programming at ECOOP, p. 25. Springer (1997)

    Google Scholar 

  27. Moggi, E.: Notions of computation and monads. Information and Computation 93(1), 55–92 (1991)

    Article  MATH  MathSciNet  Google Scholar 

  28. Oliveira, B.C.D.S., Schrijvers, T., Cook, W.R.: EffectiveAdvice: discplined advice with explicit effects. In: AOSD 2010 [4], pp. 109–120

    Google Scholar 

  29. Oliveira, B.C.D.S., Schrijvers, T., Cook, W.R.: MRI: Modular reasoning about interference in incremental programming. Journal of Functional Programming 22, 797–852 (2012)

    Article  MATH  MathSciNet  Google Scholar 

  30. Peyton Jones, S., Vytiniotis, D., Weirich, S., Shields, M.: Practical type inference for arbitrary-rank types. Journal of Functional Programming 17(1), 1–82 (2007)

    Article  MATH  MathSciNet  Google Scholar 

  31. Pierce, B.C.: Types and programming languages. MIT Press, Cambridge (2002)

    Google Scholar 

  32. Plotkin, G.D.: A note on inductive generalization. Machine Intelligence 5, 153–163 (1970)

    MathSciNet  Google Scholar 

  33. Reynolds, J.C.: Transformational systems and the algebraic structure of atomic formulas. Machine Intelligence 5, 135–151 (1970)

    Google Scholar 

  34. Rinard, M., Salcianu, A., Bugrara, S.: A classification system and analysis for aspect-oriented programs. In: Proceedings of the 12th ACM Symposium on Foundations of Software Engineering (FSE 12), pp. 147–158. ACM Press (2004)

    Google Scholar 

  35. Schrijvers, T., Oliveira, B.C.: Monads, zippers and views: virtualizing the monad stack. In: Proceedings of the 16th ACM SIGPLAN Conference on Functional Programming (ICFP 2011), Tokyo, Japan, pp. 32–44. ACM Press (September 2011)

    Google Scholar 

  36. Sheard, T., Jones, S.P.: Template meta-programming for haskell. SIGPLAN Not. 37(12), 60–75 (2002)

    Article  Google Scholar 

  37. Sulzmann, M., Wang, M.: Aspect-oriented programming with type classes. In: Proceedings of the Sixth Workshop on Foundations of Aspect-Oriented Languages (FOAL 2007), Vancouver, British Columbia, Canada, pp. 65–74. ACM Press (2007)

    Google Scholar 

  38. Tabareau, N.: A monadic interpretation of execution levels and exceptions for AOP. In: Tanter, É., Sullivan, K.J. (eds.) Proceedings of the 11th International Conference on Aspect-Oriented Software Development (AOSD 2012), Potsdam, Germany. ACM Press (March 2012)

    Google Scholar 

  39. Tabareau, N., Figueroa, I., Tanter, É.: A typed monadic embedding of aspects. In: Kinzle, J. (ed.) Proceedings of the 12th International Conference on Aspect-Oriented Software Development (AOSD 2013), Fukuoka, Japan, pp. 171–184. ACM Press (March 2013)

    Google Scholar 

  40. Tanter, É.: Expressive scoping of dynamically-deployed aspects. In: AOSD 2008 [3], pp. 168–179

    Google Scholar 

  41. Tanter, É.: Execution levels for aspect-oriented programming. In: AOSD 2010 [4], pp. 37–48

    Google Scholar 

  42. Tanter, É., Figueroa, I., Tabareau, N.: Execution levels for aspect-oriented programming: Design, semantics, implementations and applications. Science of Computer Programming (2013) (available online)

    Google Scholar 

  43. Tanter, É., Moret, P., Binder, W., Ansaloni, D.: Composition of dynamic analysis aspects. In: Proceedings of the 9th ACM SIGPLAN International Conference on Generative Programming and Component Engineering (GPCE 2010), Eindhoven, The Netherlands, pp. 113–122. ACM Press (October 2010)

    Google Scholar 

  44. Tanter, É., Tabareau, N., Douence, R.: Taming aspects with membranes. In: Proceedings of the 11th Workshop on Foundations of Aspect-Oriented Languages (FOAL 2012) [1], pp. 3–8

    Google Scholar 

  45. Toledo, R., Leger, P., Tanter, É.: AspectScript: Expressive aspects for the Web. In: AOSD 2010 [4], pp. 13–24

    Google Scholar 

  46. Wadler, P.: The essence of functional programming. In: Proceedings of the 19th ACM Symposium on Principles of Programming Languages (POPL 1992), Albuquerque, New, Mexico, USA, pp. 1–14. ACM Press (January 1992)

    Google Scholar 

  47. Wadler, P., Blott, S.: How to make ad-hoc polymorphism less ad hoc. In: Proceedings of the 16th ACM Symposium on Principles of Programming Languages (POPL 1989), Austin, TX, USA, pp. 60–76. ACM Press (January 1989)

    Google Scholar 

  48. Wand, M., Kiczales, G., Dutchyn, C.: A semantics for advice and dynamic join points in aspect-oriented programming. ACM Transactions on Programming Languages and Systems 26(5), 890–910 (2004)

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2014 Springer-Verlag Berlin Heidelberg

About this chapter

Cite this chapter

Figueroa, I., Tabareau, N., Tanter, É. (2014). Effective Aspects: A Typed Monadic Embedding of Pointcuts and Advice. In: Chiba, S., Tanter, É., Bodden, E., Maoz, S., Kienzle, J. (eds) Transactions on Aspect-Oriented Software Development XI. Lecture Notes in Computer Science, vol 8400. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-55099-7_5

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-55099-7_5

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-55098-0

  • Online ISBN: 978-3-642-55099-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics