According to the principle of encapsulation, objects should expose stable, limited interfaces and hide their implementation details. Aggregates are opaque boxes that should hide their internals. For instance, a list implemented internally with linked nodes should not reveal their existence to clients of the list. If a client of an object can reference its internals, invariants might be broken with dangerous consequences.
Unfortunately, this "boxing" of objects is usually implicit in programming language, and is by consequence hard to enforce. Ownership types have been propose to make this boxing explicit. In this project, we propose to apply ownership to dynamic languages and explore its benefits, notably to catch bugs.
We have built a first version of dynamic ownership with the following features:
Erwann Wernli, Pascal Maerki, Oscar Nierstrasz. Ownership, Filters and Crossing Handlers. In Dynamic Language Symposium (DLS), to appear, 2012