Safe reflection through polymorphism

Toon Verwaest, Lukas Renggli. Safe reflection through polymorphism. In CASTA '09: Proceedings of the first international workshop on Context-aware software technology and applications. ACM, New York, NY, USA, 2009. [doi]

Abstract

Code executed in a fully reflective system switches back and forth between application and interpreter code. These two states can be seen as contexts in which an expression is evaluated. Current language implementations obtain reflective capabilities by exposing objects to the interpreter. However, in doing so these systems break the encapsulation of the application objects. In this paper we propose safe reflection through polymorphism, \ie by unifying the interface and ensuring the encapsulation of objects from both the interpreter and application context. We demonstrate a \emphhomogeneous system that defines the execution semantics in terms of itself, thus enforcing that encapsulation is not broken.