Reflection in Direct Style
Reflection in Direct Style
复制标题
直接风格的反思
DOI:
10.1145/2047862.2047882
复制
发表时间:
2012
期刊:
影响因子:
--
通讯作者:
Kenichi Asai
中科院分区:
文献类型:
--
作者:
藤井貴啓;上野雄大;森畑明昌;大堀淳;高橋俊彦;Tetsuya Kanda;Kenichi Asai
A reflective language enables us to access, inspect, and/or modify the language semantics from within the same language framework. Although the degree of semantics exposure differs from one language to another, the most powerful approach, referred to as the behavioral reflection, exposes the entire language semantics (or the language interpreter) that defines behavior of user programs for user inspection/modification. In this paper, we deal with the behavioral reflection in the context of a functional language Scheme. In particular, we show how to construct a reflective interpreter where user programs are interpreted by the tower of metacircular interpreters and have the ability to change any parts of the interpreters during execution. Its distinctive feature compared to the previous work is that the metalevel interpreters observed by users are written in direct style. Based on the past attempt of the present author, the current work solves the level-shifting anomaly by defunctionalizing and inspecting the top of the continuation frames. The resulting system enables us to freely go up and down the levels and access/modify the direct-style metalevel interpreter. This is in contrast to the previous system where metalevel interpreters were written in continuation-passing style (CPS) and only CPS functions could be exposed to users for modification.