By Atsushi Igarashi, Robert Hirschfeld, and Hidehiko Masuhara. To appear in Proceedings of International Workshop on Foundations of Object-Oriented Languages (FOOL2012), Tucson, AZ, October 2012.
Dynamic layer composition is one of the key features in context-oriented programming (COP), an approach to improving modularity of behavioral variations that depend on the dynamic context of the execution environment. It allows a layer---a set of new or overriding methods that can belong to several classes---to be added to or removed from existing objects in a disciplined way. We develop a type system for dynamic layer composition, which may change the interfaces of objects at run time, based on a variant of ContextFJ, a core calculus for COP, and prove its soundness.