modify object behavior • But: • What is reflected onto (the “canvas”) is tied to language and/or VM • No support for language extensions (e.g., new kinds of class members, new kinds of “classes”) • ChromaKey: extend mirror-based reflection with additional indirection through generic factories (Object Algebras)
C getClass(); ... } Implementation of this is out of scope of this talk (hint: requires some base level reflection, or VM support…) Additional argument to represent the “semantics” of classes: an Object Algebra
{ C Class(String name, List<M> members); M Method(F formal, List<F> params, B body); M Field(F formal); F Formal(String name, Class<?> type); B Code(java.lang.reflect.Method m); }
meta level and object level • The meta level becomes a parameter under control of the user • Benefits • Decoupling: replace the mirror type hierarchy with your own. • Extensible: Reflect upon “entities” not anticipated by the language/runtime (i.e. for user extensible languages).
String name; } New kind of class member class Person { @Key String email; String name; } Current implementation WARNING! Leaving Standard Java (related to Recaf, see GPCE’16)
= (Point) pointClass.New(1, 2); System.out.println(p.x() + p.y()); // prints out 3 interface Point { int x(); int y(); } Need to use interfaces (“technical detail”; see Eugster, OOPSLA’06)
etc. • Custom data layout: store two ints in one long, off heap data structures, etc. • Maintain data invariants: immutability, maximal sharing, transactions, etc.
object level • Brings Object Algebra extensibility to mirror-based reflection • Choose your own reflection semantics • Reflect upon user level language extensions • Ongoing work: implementation, evaluation (managed data).