Pattern-based traits

  • Authors:
  • Weiyu Miao;Jeremy Siek

  • Affiliations:
  • University of Colorado at Boulder;University of Colorado at Boulder

  • Venue:
  • Proceedings of the 27th Annual ACM Symposium on Applied Computing
  • Year:
  • 2012

Quantified Score

Hi-index 0.00

Visualization

Abstract

There have been exciting developments with respect to compile-time reflection for C# and Java. Fähndrich et al. [2006] introduced what we call pattern-based reflection as a high-level notation for inspecting members of old classes and generating members of a new class. Huang and Smaragdakis [2008, 2011] further increased the expressiveness of pattern-based reflection and strengthened its type safety guarantees. However, these proposals took place in settings with just classes and/or mixins, which limit the ways that generated declarations can be composed (just linearly). In this paper we investigate the combination of pattern-based reflection with traits, which offer more expressive forms of composition. Further, we provide language features for manipulating sets of member declarations: giving them names, manipulating their domains using set operations, and passing them as arguments to traits. To demonstrate the expressiveness of the proposed language design, we implement a library for object-relational mapping. We also formalize the language design, defining the syntax and semantics for a language named PTFJ (for Pattern-based Traits in Featherweight Java)