skip to main content
research-article
Open Access

AspectML: A polymorphic aspect-oriented functional programming language

Published:21 May 2008Publication History
Skip Abstract Section

Abstract

This article defines AspectML, a typed functional, aspect-oriented programming language. The main contribution of AspectML is the seamless integration of polymorphism, run-time type analysis and aspect-oriented programming language features. In particular, AspectML allows programmers to define type-safe polymorphic advice using pointcuts constructed from a collection of polymorphic join points. AspectML also comes equipped with a type inference algorithm that conservatively extends Hindley--Milner type inference. To support first-class polymorphic point-cut designators, a crucial feature for developing aspect-oriented profiling or logging libraries, the algorithm blends the conventional Hindley--Milner type inference algorithm with a simple form of local type inference.

We give our language operational meaning via a type-directed translation into an expressive type-safe intermediate language. Many complexities of the source language are eliminated in this translation, leading to a modular specification of its semantics. One of the novelties of the intermediate language is the definition of polymorphic labels for marking control-flow points. When a set of labels is assembled as a pointcut, the type of each label is an instance of the type of the pointcut.

References

  1. Abadi, M. and Fournet, C. 2003. Access control based on execution history. In Proceedings of the 10th Symposium on Network and Distributed System Security (San Diego, CA). Internet Society, Reston, VA, 107--121.Google ScholarGoogle Scholar
  2. Aho, A. V., Sethi, R., and Ullman, J. D. 1986. Compilers: Principles, Techniques, and Tools. Addison-Wesley, Boston, MA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Aldrich, J. 2005. Open modules: Modular reasoning about advice. In Proceedings of the 19th European Conference on Object-Oriented Programming (Glasgow, UK). 144--168. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Avgustinov, P., Hajiyev, E., Ongkingco, N., de Moor, O., Sereni, D., Tibble, J., and Verbaere, M. 2007. Semantics of static pointcuts in AspectJ. In Proceedings of the 34th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (Nice, France). ACM, New York, 11--23. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Barendregt, H. 1985. The Lambda Calculus: Its Syntax and Semantics. Number 103 in Studies in Logic. North Holland.Google ScholarGoogle Scholar
  6. Bauer, L., Ligatti, J., and Walker, D. 2005. Composing security policies in polymer. In Proceedings of the 2005 ACM SIGPLAN Conference on Programming Language Design and Implementation (Chicago, IL). ACM, New York, 305--314. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Bruns, G., Jagadeesan, R., Jeffrey, A., and Riely, J. 2004. muABC: A minimal aspect calculus. In Proceedings of the 15th International Conference on Concurrency Theory (London, UK), P. Gardner and N. Yoshida, Eds. Lecture Notes in Computer Science, vol. 3170. Springer, Berlin, Germany, 209--224.Google ScholarGoogle Scholar
  8. Clifton, C. and Leavens, G. T. 2002. Observers and assistants: A proposal for modular aspect-oriented reasoning. In Proceedings of the 2002 Workshop on Foundations of Aspect-Oriented Languages (Enschede, The Netherlands). 33--44.Google ScholarGoogle Scholar
  9. Colcombet, T. and Fradet, P. 2000. Enforcing trace properties by program transformation. In Proceedings of the 27th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (Boston, MA). ACM, New York, 54--66. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Colyer, A. and Clement, A. 2004. Large-scale AOSD for middleware. In Proceedings of the 3rd International Conference on Aspect-Oriented Software Development. ACM, New York, 56--65. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Damas, L. and Milner, R. 1982. Principal type schemes for functional programs. In Proceedings of the 9th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (Albuquerque, NM). ACM, New York, 207--212. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Dantas, D. S. and Walker, D. 2003. Aspects, information hiding and modularity. Tech. Rep. TR-696-04, Princeton University. Nov.Google ScholarGoogle Scholar
  13. Dantas, D. S. and Walker, D. 2006. Harmless advice. In Proceedings of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (Charleston, SC). ACM, New York, 383--396. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Dantas, D. S., Walker, D., Washburn, G., and Weirich, S. 2005a. PolyAML: A polymorphic aspect-oriented functional programming language. In Proceedings of the 10th ACM SIGPLAN International Conference on Functional Programming (Tallinn, Estonia). ACM, New York, 306--319. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Dantas, D. S., Walker, D., Washburn, G., and Weirich, S. 2005b. PolyAML: A polymorphic aspect-oriented functional programmming language (extended version). Tech. Rep. MS-CIS-05-07, University of Pennsylvania. May.Google ScholarGoogle Scholar
  16. Douence, R., Fradet, P., and Südholt, M. 2004. Composition, reuse and interaction analysis of stateful aspects. In Proceedings of the 3rd International Conference on Aspect-Oriented Software Development (Lancaster, UK). ACM, New York, 141--150. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Douence, R., Motelet, O., and Südholt, M. 2001. A formal definition of crosscuts. In Proceedings of 3rd International Conference on Metalevel Architectures and Separation of Crosscutting Concerns (Kyoto, Japan), A. Yonezawa and S. Matsuoka, Eds. Lecture Notes in Computer Science, vol. 2192. Springer-Verlag, Berlin, Germany, 170--186. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Erlingsson, Ú. and Schneider, F. B. 1999. SASI enforcement of security policies: A retrospective. In Proceedings of the Workshop on New Security Paradigms (Caledon Hills, Canada). ACM, New York, 87--95. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Erlingsson, Ü. and Schneider, F. B. 2000. IRM enforcement of Java stack inspection. In Proceedings of the 2000 IEEE Symposium on Security and Privacy (Oakland, CA). IEEE Computer Society, Washington, DC, 246--255. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Evans, D. and Twyman, A. 1999. Flexible policy-directed code safety. In Proceedings of the 1999 IEEE Symposium on Security and Privacy (Oakland, CA). IEEE Computer Society, Washington, DC, 32--45.Google ScholarGoogle Scholar
  21. Filman, R. E. and Friedman, D. P. 2005. Aspect-Oriented Software Development. Addison-Wesley, Boston, MA, Chapter Aspect-Oriented Programming is Quantification and Obliviousness, 21--35.Google ScholarGoogle Scholar
  22. Fiuczynski, M., Cody, Y., Grimm, R., and Walker, D. 2005. Patch(1) considered harmful. In Proceedings of the 10th Workshop on Hot Topics in Operating Systems (Santa Fe, NM). USENIX, 91--96. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Gordon, A. and Fournet, C. 2003. Stack inspection: theory and variants. ACM Trans. Prog. Lang. Syst. 25, 3 (May), 360--399. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Harper, R. and Stone, C. 1998. A type-theoretic interpretation of Standard ML. In Proof, Language and Interaction: Essays in Honour of Robin Milner. The MIT Press, Cambridge, MA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Harper, R. W. 2005. Programming Languages: Theory and Practice. In preparation, a draft can be obtained from http://www.cs.cmu.edu/_rwh/plbook/.Google ScholarGoogle Scholar
  26. Hinze, R., Löh, A., and Oliveira, B. C. 2006. “Scrap your boilerplate” reloaded. In Proceedings of the 8th International Symposium on Functional and Logic Programming (Fuji Susono, Japan), P. Waldler and M. Hagiya, Eds. 24--26. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Jagadeesan, R., Jeffrey, A., and Riely, J. 2003. A calculus of untyped aspect-oriented programs. In Proceedings of the 17th European Conference on Object-Oriented Programming (Darmstadt, Germany). Springer-Verlag, Berlin, Germany, 415--427.Google ScholarGoogle Scholar
  28. Jagadeesan, R., Jeffrey, A., and Riely, J. 2006. Typed parametric polymorphism for aspects. Sci. Comput. Prog. 63, 3, 267--296. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Kiczales, G., Hilsdale, E., Hugunin, J., Kersten, M., Palm, J., and Griswold, W. 2001. An overview of AspectJ. In Proceedings of the 15th European Conference on Object-Oriented Programming (Budapest, Hungary). Springer-Verlag, 327--353. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Kim, M., Viswanathan, M., Ben-Abdallah, H., Kannan, S., Lee, I., and Sokolsky, O. 1999. Formally specified monitoring of temporal properties. In Proceedings of the 11th Euromicro Conference on Real-Time Systems (York, UK). 114--121.Google ScholarGoogle Scholar
  31. Lufer, K. and Odersky, M. 1992. An extension of ML with first-class abstract types. In Proceedings of the SIGPLAN Workshop on ML and its Applications (San Fransisco, California). 78--91.Google ScholarGoogle Scholar
  32. Lee, D. K., Crary, K., and Harper, R. 2007. Towards a mechanized metatheory of Standard ML. In Proceedings of the 34th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (Nice, France). ACM, New York, 173--184. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Lee, I., Kannan, S., Kim, M., Sokolsky, O., and Viswanathan, M. 1999. Run-time assurance based on formal specifications. In Proceedings of the International Conference on Parallel and Distributed Processing Techniques and Applications (Las Vegas, NV).Google ScholarGoogle Scholar
  34. Lieberherr, K. J., Lorenz, D., and Ovlinger, J. 2003. Aspectual collaborations—combining modules and aspects. The Computer Journal 46, 5 (Sept.), 542--565.Google ScholarGoogle ScholarCross RefCross Ref
  35. Masuhara, H., Kiczales, G., and Dutchyn, C. 2002. Compilation semantics of aspect-oriented programs. In Proceedings of the Workshop on Foundations of Aspect-Oriented Languages (Lancaster, UK), G. T. Leavens and R. Cytron, Eds. 17--25.Google ScholarGoogle Scholar
  36. Masuhara, H., Tatsuzawa, H., and Yonezawa, A. 2005. Aspectual caml: an aspect-oriented functional language. In Proceedings of the 10th ACM SIGPLAN International Conference on Functional Programming (Tallinn, Estonia). ACM, New York, 320--330. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Matthews, D. 2005. Poly/ML. http://www.polyml.org/.Google ScholarGoogle Scholar
  38. Milner, R. 1978. A theory of type polymorphism in programming. J. Comput. Syst. Sci. 17, 3, 348--375.Google ScholarGoogle ScholarCross RefCross Ref
  39. Milner, R., Tofte, M., Harper, R., and MacQueen, D. 1997. The Definition of Standard ML (Revised). MIT Press, Cambridge, MA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Peyton Jones, S., Vytiniotis, D., Weirich, S., and Washburn, G. 2006. Simple unification-based type inference for GADTs. In Proceedings of the 11th ACM SIGPLAN International Conference on Functional Programming (Portland, OR). ACM, New York, 50--61. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Peyton Jones, S. L., Vytiniotis, D., Weirich, S., and Shields, M. 2007. Practical type inference for arbitrary-rank types. J. Funct. Program 17, 1 (Jan.), 1--82. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Pierce, B. C. and Turner, D. N. 1998. Local type inference. In Proceedings of the 25th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (San Diego, CA). ACM, New York, 252--265. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. Plotkin, G. D. 1970. A note on inductive generalization. In Machine Intelligence. Vol. 5. Edinburgh University Press, 153--163.Google ScholarGoogle Scholar
  44. Plotkin, G. D. 1971. A further note on inductive generalization. In Machine Intelligence. Vol. 6. Edinburgh University Press, 101--124.Google ScholarGoogle Scholar
  45. Pottier, F. and Rgis-Gianas, Y. 2006. Stratified type inference for generalized algebraic data types. In Proceedings of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (Charleston, SC). ACM, New York, 232--244. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. Schneider, F. B. 2000. Enforceable security policies. ACM Transactions on Information and Systems Security 3, 1 (Feb.), 30--50. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. Sheard, T. 2005. Putting Curry-Howard to work. In Proceedings of the 2005 ACM SIGPLAN Workshop on Haskell (Tallinn, Estonia). ACM, 74--85. Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. Shields, M. and Peyton Jones, S. 2002. Lexically scoped type variables. Microsoft Research. Available at http://research.microsoft.com/Users/simonpj/papers/scoped-tyvars.Google ScholarGoogle Scholar
  49. Simonet, V. and Pottier, F. 2005. Constraint-based type inference for guarded algebraic data types. Tech. Rep. Research Report 5462, INRIA. Jan.Google ScholarGoogle Scholar
  50. Sullivan, K., Griswold, W. G., Song, Y., Cai, Y., Shonle, M., Tewari, N., and Rajan, H. 2005. Information hiding interfaces for aspect-oriented design. In Proceedings of the 10th Conference on European Software Engineering held jointly with the 13th ACM SIGSOFT International Symposium on the Foundations of Software Engineering (Lisbon, Portugal). ACM, New York, 166--175. Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. Sulzmann, M., Schrijvers, T., and Stuckey, P. J. 2006. Type inference for GADTS via herbrand constraint abduction. http//www.comp.nus.edu.sg/~sulzmann/manuscript/gadtshort.ps.Google ScholarGoogle Scholar
  52. Tucker, D. B. and Krishnamurthi, S. 2003. Pointcuts and advice in higher-order languages. In Proceedings of the 2nd International Conference on Aspect-Oriented Software Development (Boston, MA). ACM, New York, 158--167. Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. Vytiniotis, D., Weirich, S., and Peyton Jones, S. 2006. Boxy types: inference for higher-rank types and impredicativity. In Proceedings of the 11th ACM SIGPLAN International Conference on Functional Programming (Portland, OR). ACM, New York, 251--262. Google ScholarGoogle ScholarDigital LibraryDigital Library
  54. Walker, D., Zdancewic, S., and Ligatti, J. 2003. A theory of aspects. In Proceedings of the 8th ACM SIGPLAN International Conference on Functional Programming (Uppsala, Sweden). ACM, New York, 127--139. Google ScholarGoogle ScholarDigital LibraryDigital Library
  55. Wand, M., Kiczales, G., and Dutchyn, C. 2003. A semantics for advice and dynamic join points in aspect-oriented programming. ACM Trans. Prog. Lang. Syst. 26, 5, 890--910. Google ScholarGoogle ScholarDigital LibraryDigital Library
  56. Wang, M., Chen, K., and Khoo, S.-C. 2006. On the pursuit of staticness and coherence. In Proceedings of the 5th Workshop on Foundations of Aspect-Oriented Languages (Bonn, Germany).Google ScholarGoogle Scholar
  57. Washburn, G., and Weirich, S. 2005. Generalizing parametricity using information flow. In Proceedings of the 20th IEEE Symposium on Logic in Computer Science (Chicago, IL, USA). IEEE Computer Society Press, Los Alamitos, CA, 62--71. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. AspectML: A polymorphic aspect-oriented functional programming language

                    Recommendations

                    Comments

                    Login options

                    Check if you have access through your login credentials or your institution to get full access on this article.

                    Sign in

                    Full Access

                    • Published in

                      cover image ACM Transactions on Programming Languages and Systems
                      ACM Transactions on Programming Languages and Systems  Volume 30, Issue 3
                      May 2008
                      245 pages
                      ISSN:0164-0925
                      EISSN:1558-4593
                      DOI:10.1145/1353445
                      Issue’s Table of Contents

                      Copyright © 2008 ACM

                      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

                      Publisher

                      Association for Computing Machinery

                      New York, NY, United States

                      Publication History

                      • Published: 21 May 2008
                      • Accepted: 1 March 2007
                      • Revised: 1 October 2006
                      • Received: 1 March 2006
                      Published in toplas Volume 30, Issue 3

                      Permissions

                      Request permissions about this article.

                      Request Permissions

                      Check for updates

                      Qualifiers

                      • research-article
                      • Research
                      • Refereed

                    PDF Format

                    View or Download as a PDF file.

                    PDF

                    eReader

                    View online with eReader.

                    eReader