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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
In: Proceedings of the 11th Workshop on Foundations of Aspect-Oriented Languages (FOAL 2012), Potsdam, Germany. ACM Press (March 2012)
Aldrich, J.: Open modules: Modular reasoning about advice. In: Gao, X.-X. (ed.) ECOOP 2005. LNCS, vol. 3586, pp. 144–168. Springer, Heidelberg (2005)
In: Proceedings of the 7th ACM International Conference on Aspect-Oriented Software Development (AOSD 2008), Brussels, Belgium. ACM Press (April 2008)
In: Proceedings of the 9th ACM International Conference on Aspect-Oriented Software Development (AOSD 2010), Rennes and Saint Malo, France. ACM Press (March 2010)
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)
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)
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)
De Fraine, B., Südholt, M., Jonckers, V.: StrongAspectJ: flexible and safe pointcut/advice bindings. In: AOSD 2008 [3], pp. 60–71
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)
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)
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)
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)
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)
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)
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)
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)
Jones, M.P.: Type classes with functional dependencies. In: Smolka, G. (ed.) ESOP 2000. LNCS, vol. 1782, pp. 230–244. Springer, Heidelberg (2000)
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)
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)
Learn you a haskell website (2013), http://learnyouahaskell.com/
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)
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)
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)
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)
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)
Meuter, W.D.: Monads as a theoretical foundation for aop. In: International Workshop on Aspect-Oriented Programming at ECOOP, p. 25. Springer (1997)
Moggi, E.: Notions of computation and monads. Information and Computation 93(1), 55–92 (1991)
Oliveira, B.C.D.S., Schrijvers, T., Cook, W.R.: EffectiveAdvice: discplined advice with explicit effects. In: AOSD 2010 [4], pp. 109–120
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)
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)
Pierce, B.C.: Types and programming languages. MIT Press, Cambridge (2002)
Plotkin, G.D.: A note on inductive generalization. Machine Intelligence 5, 153–163 (1970)
Reynolds, J.C.: Transformational systems and the algebraic structure of atomic formulas. Machine Intelligence 5, 135–151 (1970)
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)
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)
Sheard, T., Jones, S.P.: Template meta-programming for haskell. SIGPLAN Not. 37(12), 60–75 (2002)
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)
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)
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)
Tanter, É.: Expressive scoping of dynamically-deployed aspects. In: AOSD 2008 [3], pp. 168–179
Tanter, É.: Execution levels for aspect-oriented programming. In: AOSD 2010 [4], pp. 37–48
Tanter, É., Figueroa, I., Tabareau, N.: Execution levels for aspect-oriented programming: Design, semantics, implementations and applications. Science of Computer Programming (2013) (available online)
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)
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
Toledo, R., Leger, P., Tanter, É.: AspectScript: Expressive aspects for the Web. In: AOSD 2010 [4], pp. 13–24
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)
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)
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)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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)