Extending Groovy’s Reification and Closures

Conference paper
Part of the Advances in Intelligent Systems and Computing book series (AISC, volume 276)

Abstract

Groovy is a dynamic language that allows the easy modification of its own behaviour. A simple mechanism to introduce changes in the core language is by using Abstract Syntax Tree(AST) transformations. In this paper we describe two new features added to Groovy: the introduction of Reification, and the enhancement of Groovy Closures. In the first extension we make it possible for the user to know the types of a generic class during runtime. In the second one, Groovy closures were improved with the addition of two methods: one to provide closures return type and another to give the closure’s source code.

Keywords

Abstract Syntax Tree Transformations (AST) Groovy Reified Types Generics Closures Lambda Expressions Attribute Oriented Programming 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
  2. 2.
  3. 3.
    GContracts A Programming by Contract Extension for Groovy!, https://github.com/andresteingress/gcontracts/wiki
  4. 4.
    GPars Groovy Parallel Systems, http://gpars.codehaus.org/
  5. 5.
  6. 6.
    Java 8 - Closures, Lambda Expressions Demystified, http://frankhinkel.blogspot.pt/2012/11/java-8-closures-lambda-expressions.html
  7. 7.
    Axelsen, E.W., Krogdahl, S.: Groovy package templates: supporting reuse and runtime adaption of class hierarchies. ACM SIGPLAN Notices 44(12), 15–26 (2009)CrossRefGoogle Scholar
  8. 8.
    Burmako, E.: Scala macros: Let our powers combine. In: Proceedings of the 4th Annual Scala Workshop (2013)Google Scholar
  9. 9.
    Cazzola, W., Vacchi, E.: Fine-grained annotations for pointcuts with a finer granularity. In: Shin, S.Y., Maldonado, J.C. (eds.) SAC, pp. 1706–1711. ACM (2013)Google Scholar
  10. 10.
    Cazzola, W., Vacchi, E.: @java: annotations in freedom. In: Shin, S.Y., Maldonado, J.C. (eds.) SAC, pp. 1688–1693. ACM (2013)Google Scholar
  11. 11.
    Cortinhas, C., Barros, F.: Extending the groovy language using ast transformations to monitor variables and methods. In: Rocha, Á., Correia, A.M., Wilson, T., Stroetmann, K.A. (eds.) Advances in Information Systems and Technologies. AISC, vol. 206, pp. 745–752. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  12. 12.
    Dinkelaker, T., Mezini, M.: Dynamically linked domain-specific extensions for advice languages. In: Proceedings of the 2008 AOSD Workshop on Domain-Specific Aspect Languages, 3 p. ACM (2008)Google Scholar
  13. 13.
    Heinlein, C.: Most-flexipl: modular, statically typed, flexibly extensible programming language. In: Proceedings of the ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software, pp. 159–178. ACM (2012)Google Scholar
  14. 14.
    König, D., Paul, P.K., Laforge, G., Jon, J.S.: Groovy in Action, 2nd edn. Manning (2011)Google Scholar
  15. 15.
    Naftalin, M., Wadler, P.: Java generics and collections. O’Reilly (2009)Google Scholar
  16. 16.
    Wada, H., Suzuki, J.: Modeling turnpike frontend system: A model-driven development framework leveraging uml metamodeling and attribute-oriented programming. In: Briand, L.C., Williams, C. (eds.) MoDELS 2005. LNCS, vol. 3713, pp. 584–600. Springer, Heidelberg (2005)CrossRefGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2014

Authors and Affiliations

  1. 1.Departamento de Engenharia InformáticaUniversidade de CoimbraCoimbraPortugal

Personalised recommendations