A PATTERN FOR STATIC REFLECTION ON FIELDS - Sharing Internal Representations in Indexed Family Containers

Andreas P. Priesnitz, Sibylle Schupp

2007

Abstract

Reflection allows defining generic operations in terms of the constituents of objects. These definitions incur overhead if reflection takes place at run time, which is the common case in popular languages. If performance matters, some compile-time means of reflection is desired to obviate that penalty. Furthermore, the information provided by static reflection can be utilised for class generation, e.g., to optimize internal representation. We demonstrate how to provide static reflection on class field properties by means of generic components in an OO language with static meta-programming facilities. Surprisingly, a major part of the solution is not specific to the particular task of providing reflection. We define the internal representation of classes by a reworked implementation of a generic container that models the concept of a statically indexed family. The proposed features of this implementation are also beneficial to its use as a common container.

References

  1. Attardi, G. and Cisternino, A. (2001). Reflection Support by Means of Template Metaprogramming. In Proc. 3rd Int. Conf. on Generative and Component-Based Software Engineering (GCSE), volume 2186 of LNCS, pages 118-127. Springer.
  2. Bracha, G. and Cook, W. (1990). Mixin-Based Inheritance. In Proc. 5th ACM Symp. on Object Oriented Programming: Systems, Languages and Applications (OOPSLA), volume 25, number 10 of ACM SIGPLAN Notices, pages 303-311. ACM Press.
  3. Calcagno, C., Taha, W., Huang, L., and Leroy, X. (2003). Implementing Multi-Stage Languages using ASTs, Gensym, and Reflection. In Proc. 2nd Int. Conf. on Generative Programming and Component Engineering (GPCE), volume 2830 of LNCS, pages 57-76. Springer.
  4. Czarnecki, K. and Eisenecker, U. W. (2000). Generative Programming: Methods, Tools and Applications. Addison-Wesley.
  5. de Guzman, J. and Marsden, D. (2006). Fusion Library Homepage. http://spirit.sourceforge. net/dl_more/fusion_v2/libs/fusion.
  6. Eisenecker, U. W., Blinn, F., and Czarnecki, K. (2000). A Solution to the Constructor-Problem of Mixin-Based Programming in C++. In Proc. First Workshop on C++ Template Programming at 2nd GCSE.
  7. Hinze, R. and Löh, A. (2006). “Scrap Your Boilerplate” Revolutions. In Uustalu, T., editor, Proc. 8th Int. Conf. on Mathematics of Program Construction (MPC), volume 4014 of LNCS, pages 180-208. Springer.
  8. Järvi, J. (1999). Tuples and Multiple Return Values in C++. Technical Report 249, Turku Centre for Computer Science.
  9. Järvi, J. (2001). Boost Tuple Library Homepage. http: //www.boost.org/libs/tuple.
  10. Lämmel, R. and Peyton Jones, S. (2003). Scrap Your Boilerplate: A Practical Design Pattern for Generic Programming. In Proc. ACM SIGPLAN Int. Workshop on Types in Language Design and Implementation (TLDI), volume 38, number 3 of ACM SIGPLAN Notices, pages 26-37. ACM Press.
  11. Munkby, G., Priesnitz, A., Schupp, S., and Zalewski, M. (2006). Scrap++: Scrap Your Boilerplate in C++. In Proc. 2006 ACM SIGPLAN Workshop on Generic Programming (WGP), pages 66-75. ACM Press.
  12. Smaragdakis, Y. and Batory, D. (2000). Mixin-Based Programming in C++. In Proc. 2nd Int. Symp. on Generative and Component-Based Software Engineering (GCSE), volume 2177 of LNCS, pages 163-177. Springer.
  13. Weiss, R. and Simonis, V. (2003). Storing properties in grouped tagged tuples. In Proc. 5th Int. Conf. on Perspectives of Systems Informatics (PSI), volume 2890 of LNCS, pages 22-29. Springer.
  14. Winch, E. (2001). Heterogeneous Lists of Named Objects. In Proc. Second Workshop on C++ Template Programming at 16th OOPSLA.
Download


Paper Citation


in Harvard Style

P. Priesnitz A. and Schupp S. (2007). A PATTERN FOR STATIC REFLECTION ON FIELDS - Sharing Internal Representations in Indexed Family Containers . In Proceedings of the Second International Conference on Software and Data Technologies - Volume 1: ICSOFT, ISBN 978-989-8111-05-0, pages 30-37. DOI: 10.5220/0001336300300037


in Bibtex Style

@conference{icsoft07,
author={Andreas P. Priesnitz and Sibylle Schupp},
title={A PATTERN FOR STATIC REFLECTION ON FIELDS - Sharing Internal Representations in Indexed Family Containers},
booktitle={Proceedings of the Second International Conference on Software and Data Technologies - Volume 1: ICSOFT,},
year={2007},
pages={30-37},
publisher={SciTePress},
organization={INSTICC},
doi={10.5220/0001336300300037},
isbn={978-989-8111-05-0},
}


in EndNote Style

TY - CONF
JO - Proceedings of the Second International Conference on Software and Data Technologies - Volume 1: ICSOFT,
TI - A PATTERN FOR STATIC REFLECTION ON FIELDS - Sharing Internal Representations in Indexed Family Containers
SN - 978-989-8111-05-0
AU - P. Priesnitz A.
AU - Schupp S.
PY - 2007
SP - 30
EP - 37
DO - 10.5220/0001336300300037