Presentation is loading. Please wait.

Presentation is loading. Please wait.

Comparing Universes and Existential Ownership Types Nicholas Cameron Werner Dietl ETH Zurich Victoria University of Wellington.

Similar presentations


Presentation on theme: "Comparing Universes and Existential Ownership Types Nicholas Cameron Werner Dietl ETH Zurich Victoria University of Wellington."— Presentation transcript:

1 Comparing Universes and Existential Ownership Types Nicholas Cameron Werner Dietl ETH Zurich Victoria University of Wellington

2 Ownership

3 ● Structure the heap into a hierarchy ● Enforce this structure statically ● Many ways to implement this idea ● Topology (description) vs encapsulation

4 Ownership Types ● Ownership information presented using context parameters class C { C f1; C f2; } – Clarke, Potter, Noble; OOPSLA '98 – Clarke; PhD Thesis '01 – Clarke, Drossopoulou; OOPSLA '02 –....

5 Universes ● Ownership information expressed using annotations – Universe modifiers class C { peer C f1; rep C f2; any C f3; } – Müller, Poetzsch-Heffter; PLFP '99 – Müller '01 – Dietl, Müller; JOT '05 – Cunningham et al; FMCO '08 –....

6 Universes ● Internal types – lost C – self C

7 Comparison ● rep C ● peer C ● self C ● any C ● lost C ● C

8 Existential Quantification ● Jo Ǝ – Cameron, Drossopoulou; ESOP '09 ● Expresses partial knowledge about ownership – Ǝ x.C ● Denotes an object owned by some unknown object

9 Comparison ● rep C ● peer C ● self C ● any C ● lost C ● C ● Ǝ x.C ● C – Where x is fresh

10 Comparison - Jo Ǝ - ● Full power of Jo Ǝ not required to model Universes ● We use a smaller calculus - Jo Ǝ -

11 Comparison - Jo Ǝ - ● In – Owner parameter – this and owner contexts – Existential quantification – Implicit packing and unpacking – subclassing ● Out – Context parameters – Local variables as contexts – Generics – Bounded quantification – Explicit packing and unpacking – Parametric methods

12 Comparison - Subtyping ● Universe modifier ordering corresponds to existential introduction in subtyping ● eg, – peer C <: any C – C

13 Comparison – Type Checking ● Viewpoint adaptation used in Universes to adapt modifiers to a different context ● Corresponds to substitution of context parameters, existential unpacking, and some extras

14 Comparison - Repacking ● Universes can give an expression a lost type ● Jo Ǝ repacks unpacked context parameters

15 Formalisation of Universes ● An alternative formalisation of Universes ● More closely matches Jo Ǝ – i.e., more closely matches the underlying typing properties

16 Formalisation of Universes ● lost types are closed to any types – Safe because any C is a supertype of lost C, but can't do anything with lost C ● lost types are only sub- (or super)types of any types ● C – Not even reflexivity ● C – Don't need to check for lost in the type rules

17 Formalisation of Universes

18 Formal Properties ● We prove translation from Universes to alternate Universes to Jo Ǝ -

19 Summary ● Universes and Ownership Types describe the heap structures – We've only examined the descriptive, topological factors ● Universes can be formalised more closely to existing type systems ● A starting point to compare expressivity – Generics

20 Generics ● Future work ● Add type parameters to Universes and Jo Ǝ - ● Compares GUT ● Expressivity of context parameters mostly given by type parameters: – class List { List next; Object datum; } – class List { List next; X datum; }

21 Thank you! Questions? ncameron@ecs.vuw.ac.nz


Download ppt "Comparing Universes and Existential Ownership Types Nicholas Cameron Werner Dietl ETH Zurich Victoria University of Wellington."

Similar presentations


Ads by Google