Download presentation
Presentation is loading. Please wait.
Published byAlfonso Wheeldon Modified over 10 years ago
1
1 Variant Ownership with Existential Types Nicholas Cameron Sophia Drossopoulou Imperial College London
2
2 Outline Variant ownership Existential types for variance Combine with generics for expressiveness
3
ncameron@doc.ic.ac.uk 3 class List { Object datum; List next; } List
4
4 GUI e.g. window panel1 panel2 button1 button2 button3 button4
5
ncameron@doc.ic.ac.uk 5 Subtype Variance class Window {... void render(Panel p) { List allWidgets =... ;... }... }
6
ncameron@doc.ic.ac.uk 6 Subtype Variance class Window {... void render(Panel p) { List allWidgets =... ;... }... }
7
7 GUI e.g. window panel1 panel2 button1 button2 button3 button4
8
ncameron@doc.ic.ac.uk 8 Subtype Variance class Window {... void render(Panel p) { List allWidgets =... ;... }... } Panel
9
ncameron@doc.ic.ac.uk 9 Subtype Variance Already exists! – On Ownership and Accessibility (Lu and Potter, ECOOP 06) – any owner in universes (Müller, Dietl,...) – ? in MOJO (Cameron, Drossopoulou, Noble, Smith, OOPSLA 07) –...
10
ncameron@doc.ic.ac.uk 10 Existential Types List
11
ncameron@doc.ic.ac.uk 11 Existential Types List
12
ncameron@doc.ic.ac.uk 12 Existential Types List o.List
13
ncameron@doc.ic.ac.uk 13 Owner Polymorphic Methods Useful for iterators, etc. Require existential types Expressible but not denotable types Similar problem to modelling wildcards - e.g., Wed 10:00am
14
ncameron@doc.ic.ac.uk 14 Generics and Ownership class List { Object datum; } List vs Class List { X datum; } List > [Potanin, Noble, Clarke, Biddle, OOPSLA 06]
15
ncameron@doc.ic.ac.uk 15...and Existential Owners o.List > List > o.List > List >>
16
ncameron@doc.ic.ac.uk 16 Benefits Expressive and uniform Easy to reason about Well understood mechanism – Existential types – Wildcards Todo Encapsulation properties Application/relation to other systems
17
ncameron@doc.ic.ac.uk 17 Thank You!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.