multiple ownership
DESCRIPTION
Multiple Ownership. Nicholas Cameron Sophia Drossopoulou James Noble Matthew Smith. Background – Ownership Types Multiple Ownership Objects in Boxes Variance - ? MOJO Effects. Background. Ownership Types. The heap is messy:. Ownership Types. Organise it:. Ownership Types. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/1.jpg)
Multiple Ownership
Nicholas CameronSophia Drossopoulou
James NobleMatthew Smith
![Page 2: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/2.jpg)
• Background – Ownership Types
• Multiple Ownership• Objects in Boxes• Variance - ?• MOJO
• Effects
![Page 7: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/7.jpg)
Ownership Types
class Project<o> { Task<this> t1; Task<this> t2; List<this, o> clients;}
![Page 11: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/11.jpg)
Objects in Boxes
• Single owner interpretation:
• An object is in its owner’s box
![Page 13: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/13.jpg)
One Owner is not Enough
• 75% of ownership structures require multiple ownership• [34] Mitchell, ECOOP, ’06
• Trees can not describe non-hierarchical structures
![Page 14: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/14.jpg)
Objects in Boxes
• Multiple Ownership: objects may be in more than one box
• An object with multiple owners is in the intersection of their boxes:
![Page 18: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/18.jpg)
MOJO
• Class declarations have the usual, formal ownership parameters:
class C<o, d> …
![Page 19: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/19.jpg)
MOJO
• Class declarations have the usual, formal ownership parameters:
class C<o, d> …• Types may have multiple corresponding
actual owner parameters:
C<b, c>
![Page 20: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/20.jpg)
MOJO
• Class declarations have the usual, formal ownership parameters:
class C<o, d> …• Types may have multiple corresponding
actual owner parameters:
C<b, c>
C<a & b, c >
![Page 21: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/21.jpg)
MOJO
• Class declarations have the usual, formal ownership parameters:
class C<o, d> …• Types may have multiple corresponding
actual owner parameters:
C<b, c>
C<a & b, c >
C<a & b & ?, c & a>
![Page 22: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/22.jpg)
MOJO
class Connection<o> { … }
class Client<o, s> { Connection<this & s> c;}
class Server<o> { Connection<this & ?> c;}
![Page 25: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/25.jpg)
Variance
• Connection<this & ?>• Some box
• May be the intersection of several boxes
• Variance in the number of owners
![Page 26: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/26.jpg)
Subtyping
• Subtyping with wildcards is variant with respect to owners:
C<a> <: C<?>
![Page 27: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/27.jpg)
Subtyping
• Subtyping with wildcards is variant with respect to owners:
C<a> <: C<?>
C<a> <: C<a & ?>
![Page 28: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/28.jpg)
Subtyping
• Subtyping with wildcards is variant with respect to owners:
C<a> <: C<?>
C<a> <: C<a & ?>
C<a & b & ?> <: C<a & ?>
![Page 29: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/29.jpg)
Subtyping
• Subtyping with wildcards is variant with respect to owners:
C<a> <: C<?>
C<a> <: C<a & ?>
C<a & b & ?> <: C<a & ?>
C<?> </: C<a>
C<a> </: C<a & b>
![Page 31: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/31.jpg)
Constraintsclass D<a, b> a intersects b { D<a, b>
}
class E<a, b> a disjoint b { }
![Page 32: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/32.jpg)
Constraintsclass D<a, b> a intersects b { D<a, b> }
class E<a, b> a disjoint b { D<a, b> }
![Page 33: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/33.jpg)
Constraintsclass D<a, b> a intersects b { D<a, b> Object<a & b> }
class E<a, b> a disjoint b { D<a, b> }
![Page 34: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/34.jpg)
Typing - strict
• Strict method sends and assignments to deal with variance of owners:class C<o> { C<o> f;}
C<a> ca; C<a & ?> c1; C<a & ?> c2;
ca.f = ca;
![Page 35: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/35.jpg)
Typing - strict
• Strict method sends and assignments to deal with variance of owners:class C<o> { C<o> f;}
C<a> ca; C<a & ?> c1; C<a & ?> c2;
ca.f = ca; c1.f = c2;
![Page 40: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/40.jpg)
Effects
Task<x> t1;Task<y> t2;…t1.f; // reads x / writes εt1.f = t2.f; // reads x,y / writes x
![Page 41: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/41.jpg)
Effects with Multiple Owners
Task<x & ?> t1;Task<y & z> t2;…t1.f; // reads x & ? / writes ε
![Page 42: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/42.jpg)
Effects with Multiple Owners
Task<x & ?> t1;Task<y & z> t2;…t1.f; // reads x & ? / writes εt1.f = t2.f; // reads x & ?,y & z/ writes x & ?
![Page 44: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/44.jpg)
Disjointness
• Two expressions are disjoint if their effects do not overlap
• Complicated by ? – but & = intersection
![Page 46: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/46.jpg)
Future Work
• Explore variant owners using existential types
class TaskList<o, d> { Task<d & ?> datum; TaskList<o, d> next;}
![Page 48: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/48.jpg)
Future Work
• Constraints• Topology - inside• Unary - may read, may write• Binary – may point to, may modify
![Page 49: Multiple Ownership](https://reader036.vdocuments.net/reader036/viewer/2022062519/568150b2550346895dbeced4/html5/thumbnails/49.jpg)
Summary
• Ownership Types• Multiple Ownership
• Objects in Boxes• Variance• MOJO
• Effects
• Thank you!• Any questions?