1 / 41

Tribal Ownership

Tribal Ownership. Nicholas Cameron James Noble Tobias Wrigstad Victoria University of Wellington Uppsala University. Tribe. world. c1:Canvas. c2:Canvas. s1:Shape. s3:Shape. s2:Shape. s4:Shape. r1:Rectangle. r2:Rectangle. c3:InCanvas. Ownership. world. c1 :Canvas. c2 :Canvas.

eagan-pitts
Télécharger la présentation

Tribal Ownership

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Tribal Ownership Nicholas Cameron James Noble Tobias Wrigstad Victoria University of Wellington Uppsala University

  2. Tribe world c1:Canvas c2:Canvas s1:Shape s3:Shape s2:Shape s4:Shape r1:Rectangle r2:Rectangle c3:InCanvas ...

  3. Ownership world c1:Canvas c2:Canvas s1:Shape s3:Shape s2:Shape s4:Shape r1:Rectangle r2:Rectangle c3:InCanvas ...

  4. Tribal Ownership world c1:Canvas c2:Canvas s1:Shape s3:Shape s2:Shape s4:Shape r1:Rectangle r2:Rectangle c3:InCanvas ...

  5. Questions ?

  6. Virtual Classes • Virtual Classes • Nested Classes • Family Polymorphism • Class Families • Nested Inheritance • ...

  7. Virtual Classes • Scala • Newspeak • GBeta • ...

  8. Tribe class Canvas { class Shape { ... } class Circle extends Shape { ... } class Rectangle extends Shape { ... } ... } class ICanvas extends Canvas { class Shape { void onClick() { ... } } }

  9. Tribe class Canvas { class Shape { ... } class Circle extends Shape { ... } class Rectangle extends Shape { ... } ... } class InCanvas extends Canvas { class Shape { void onClick() { ... } } }

  10. Tribe Canvas Shape Circle Rectangle

  11. Tribe Canvas InCanvas Shape Shape onClick() Circle Circle onClick() Rectangle Rectangle onClick()

  12. Canvas InCanvas Shape Shape onClick() Circle Circle onClick() Rectangle Rectangle onClick()

  13. Tribe world c1:Canvas c2:Canvas s1:Shape s3:Shape s2:Shape s4:Shape r1:Rectangle r2:Rectangle c3:InCanvas ...

  14. Tribe Types c1.Shape c2.Shape

  15. Tribe Types class Canvas { this.Shape f1; world.Canvas f2; class Shape { this.out.out.Canvasf3; this.out.Circle f4; } class Circle extends Shape { ... } }

  16. Tribe Types class Canvas { this.Shape f1; world.Canvas f2; class Shape { ... } } world f2:Canvas f4:Canvas :Canvas f1:Shape :Shape f3:Circle

  17. Tribe Types class Canvas { ... class Shape { this.out.Circle f3; this.out.out.Canvas f4; } } world f2:Canvas f4:Canvas :Canvas f1:Shape :Shape f3:Circle

  18. Ownership Types

  19. Ownership Types class List<owner, dOwner> { ListNode<this, dOwner> first; ... } class ListNode<owner, dOwner> { ListNode<owner, dOwner> next; Object<dOwner> datum; ... } new List<this, world>();

  20. What if... ?

  21. world c1:Canvas c2:Canvas s1:Shape s3:Shape r1:Rectangle r2:Rectangle ncameron@ecs.vuw.ac.nz 22

  22. Tribal Ownership c1.Shape

  23. Tribe class Canvas { this.Shape f1; world.Canvas f2; class Shape { this.out.Circle f3; this.out.out.Canvas f4; } class Circle extends Shape { ... } }

  24. Tribal Ownership class Canvas { this.Shape f1; world.Canvas f2; class Shape { this.out.Circle f3; this.out.out.Canvas f4; } class Circle extends Shape { ... } }

  25. What about List? class List<owner, dOwner> { ListNode<this, dOwner> first; ... } class ListNode<owner, dOwner> { ListNode<owner, dOwner> next; Object<dOwner> datum; ... } new List<this, world>();

  26. What about List? - Generics class List<X> { this.ListNode first; class ListNode { this.out.ListNode next; Xdatum; ... } ... } new this.List<world.Object>();

  27. What about List? - Generics class List<X> { this.ListNode first; class ListNode { this.out.ListNode next; X datum; ... } ... } new this.List<world.Object>();

  28. What about List? class List<X> { this.ListNode first; class ListNode { this.out.ListNode next; X datum; ... } ... } new this.List<world.Object>();

  29. What about List? – Module classes module Collections { class List<X> { ... } } class Foo imports world.Collections { this.List<world.Object> f; }

  30. Encapsulation

  31. Encapsulation Owners-as-Dominators Owners-as-Modifiers

  32. Descriptive Ownership

  33. O-as-D

  34. Encapsulation Owners-as-Local-Dominators

  35. O-as-LD

  36. O-as-LD public private Only public classes can be named externally

  37. Summary • Virtual classes in Tribe give ownership • No syntactic overhead • Generics • Module classes • Cross family inheritance • Owners-as-Local-Dominators

  38. Thank you!

  39. Questions ?

More Related