Authors:
Andreas P. Priesnitz
and
Sibylle Schupp
Affiliation:
Chalmers Technical University, Sweden
Keyword(s):
Static Reflection, Serialization, Container, Generative Programming, High Performance.
Related
Ontology
Subjects/Areas/Topics:
Algorithms and Data Structures
;
Object-Oriented Programming
;
Programming Languages
;
Software Engineering
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.