Ego: Controlling the Power of Simplicity
Ego is a small research language design that uses a linear type system
to statically type changes to the types of objects at run time.
Ego is inspired by the Self programming
language's powerful dynamic features, allowing programmers to add and
remove methods from objects and to change the inheritance hierarchy at
run time. These facilities are useful for modeling objects that
behave in different ways at different points in the object's
lifecycle. Unstructured use of these techniques, however, can
result in arbitrary changes to the interface of the object, and thus is
incompatible with static type checking.
Ego addresses this challenge with a structural type system for tracking
changes to the interface of an object as methods are added and removed,
and inheritance is changed at run time. The type system tracks
the linearity of object and method references in order to ensure that
objects whose interfaces change are not aliased. The paper below
shows how our type system can express and enforce interesting protocol
specifications. It then defines a formal model of the language
and type system, and proves that the type system is sound. Thus,
Ego is a foundation for languages that combine much of the power of
dynamic languages like Self with the benefits of static typechecking.
- Andi Bejleri, Jonathan Aldrich, and Kevin Bierhoff. Ego:
Controlling the Power of Simplicity.
Proceedings of the Workshop on Foundations of Object Oriented Languages
(FOOL/WOOD '06), January 2006.
- This is the best introduction to Ego
- Andi Bejleri, Jonathan Aldrich, and Kevin Bierhoff. A
type checked prototype-based model with linearity. Carnegie
Mellon Technical Report CMU-ISRI-04-142, December 2004.
- This paper has the full type soundness proofs for the paper
above (actually, for a slightly earlier version of the same langauge)
We have released a preliminary implementation
of the ideas in Ego.