sheep cloning - github pages · paley li, nicholas cameron, and james noble 1 . object cloning...
TRANSCRIPT
![Page 1: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/1.jpg)
SHEEP CLONING
Paley Li, Nicholas Cameron, and James Noble
1
![Page 2: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/2.jpg)
Object cloning
• How do you do object cloning?
2
![Page 3: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/3.jpg)
Shallow cloning
• Copies an object and alias the references in that object.
3
![Page 4: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/4.jpg)
Shallow cloning
3
foo
a
b
• Copies an object and alias the references in that object.
![Page 5: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/5.jpg)
Shallow cloning
3
foo’
b
a
foo
a
b
• Copies an object and alias the references in that object.
![Page 6: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/6.jpg)
Deep cloning
• Copies the object and its referenced objects.
4
![Page 7: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/7.jpg)
Deep cloning
4
• Copies the object and its referenced objects.
foo
a
b
![Page 8: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/8.jpg)
Deep cloning
• Copies the object and its referenced objects.
4
a
foo
b
a
foo’
b
![Page 9: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/9.jpg)
- Shallow cloning is too shallow
9
displayWindow
5
scrollBar
![Page 10: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/10.jpg)
- Shallow cloning is too shallow
10
displayWindow
5
scrollBar
displayWindow’
![Page 11: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/11.jpg)
11
6
- Shallow cloning is too shallow
displayWindow displayWindow’
![Page 12: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/12.jpg)
7
- Deep cloning is too deep
displayWindow
imageDatabase
![Page 13: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/13.jpg)
7
- Deep cloning is too deep
displayWindow
imageDatabase
displayWindow’
imageDatabase’
![Page 14: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/14.jpg)
8
- Deep cloning is too deep
displayWindow displayWindow’
![Page 15: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/15.jpg)
Common practices
• Cloning in Java (Cloneable) and C# (ICloneable):
• Default clone() method is shallow.
• Defining deep cloning is inconvenient and prone to bugs.
• Requires type casting.
9
![Page 16: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/16.jpg)
Common practices
10
• Cloning in C++ :
• Copy constructors and assignment operators.
• Cloning in Eiffel :
• Inherit shallow and deep cloning from the
ANY class.
![Page 17: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/17.jpg)
Common practices
• Most practices still suffer from the flaws of shallow and
deep cloning.
• Not automated.
• “Programmer knows best” - they have to define their own cloning.
• What if we have the information to produce more sensible
clones, but had overlooked it?
11
![Page 18: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/18.jpg)
• We aim to formalise a cloning model that is just right.
• It needs to be able to identify areas that are “important” to
an object.
• Only copy those “important” areas.
12
- The ideal model
![Page 19: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/19.jpg)
Ownership Types
• Ownership types enforce a hierarchical topology over the
heap.
13
![Page 20: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/20.jpg)
• Context is the formal set of objects owned by an object.
• Representation is the set of objects which are
conceptually part of an object.
14
Ownership Types
![Page 21: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/21.jpg)
• Context is the formal set of objects owned by an object.
• Representation is the set of objects which are
conceptually part of an object.
14
Ownership Types
Representation = context =
![Page 22: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/22.jpg)
Deep Ownership
15
• All reference paths to an object must pass through that
object’s owner.
• Also known as owners-as-dominators.
X
X
![Page 23: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/23.jpg)
Deep Ownership
15
• All reference paths to an object must pass through that
object’s owner.
• Also known as owners-as-dominators.
![Page 24: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/24.jpg)
Sheep = Shallow + Deep
• Utilises ownership types to identify the “important bits” of
each object.
• Cloning an object’s representation:
• Copies every object inside the object’s context.
• Aliases every reference to objects outside the object’s context.
16
![Page 25: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/25.jpg)
17
- Sheep cloning is just right!
displayWindow
![Page 26: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/26.jpg)
17
- Sheep cloning is just right!
displayWindow displayWindow’
![Page 27: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/27.jpg)
17
- Sheep cloning is just right!
displayWindow displayWindow’
![Page 28: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/28.jpg)
17
- Sheep cloning is just right!
displayWindow displayWindow’
![Page 29: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/29.jpg)
Sheep cloning
• We have formalised sheep cloning in an ownership
system with deep ownership.
• We have proved soundness and an assortment of
correctness property of our formalism.
18
![Page 30: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/30.jpg)
A touch of formal
19
![Page 31: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/31.jpg)
A touch of formal
19
![Page 32: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/32.jpg)
A touch of formal
19
![Page 33: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/33.jpg)
A touch of formal
19
![Page 34: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/34.jpg)
A touch of formal
19
![Page 35: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/35.jpg)
A touch of formal
19
![Page 36: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/36.jpg)
A touch of formal
19
![Page 37: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/37.jpg)
A touch of formal
19
![Page 38: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/38.jpg)
A touch of formal
19
![Page 39: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/39.jpg)
A touch of formal
20
![Page 40: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/40.jpg)
A touch of formal
21
![Page 41: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/41.jpg)
A touch of formal
21
Original object
![Page 42: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/42.jpg)
A touch of formal
21
Original object
![Page 43: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/43.jpg)
A touch of formal
21
Original object
![Page 44: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/44.jpg)
A touch of formal
21
Original heap
![Page 45: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/45.jpg)
A touch of formal
21
Map
![Page 46: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/46.jpg)
A touch of formal
21
Sheep clone
![Page 47: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/47.jpg)
A touch of formal
21
New heap (containing the
Sheep clone)
![Page 48: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/48.jpg)
A touch of formal
22
• SheepAux function:
• R-SheepInside: Copies the object if it is inside the original
object.
• R-SheepOutside: Creates an alias to the object if the object is
outside the original object.
• R-SheepRef: Creates a reference to an existing Sheep clone of an
object using the Map.
• R-SheepNull: Returns a null, when Sheep cloning a null.
![Page 49: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/49.jpg)
Can we clone it?
23
B
A
C
D
• Lets Sheep clone object A.
![Page 50: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/50.jpg)
Can we clone it?
23
• R-SheepInside creates the object A’ by copying A.
B
A
C
D
A’
Map: A A’
![Page 51: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/51.jpg)
Can we clone it?
23
• R-SheepOutside creates an alias to D.
B
A
C
D
A’
Map: A A’
D D
![Page 52: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/52.jpg)
Can we clone it?
23
• R-SheepInside creates the object B’ by copying B.
B
A
C
D
A’
Map: A A’
D D B B’
B’
![Page 53: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/53.jpg)
Can we clone it?
23
• R-SheepInside creates the object C’ by copying C.
B
A
C
D
A’
B’
C’
Map: A A’
D D B B’
C C’
![Page 54: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/54.jpg)
…. Yes we can!
23
• R-SheepRef creates the reference from object C’ to object B’ using the map.
B
A
C
D
A’
B’
C’
Map: A A’
D D B B’
C C’
![Page 55: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/55.jpg)
Proving the formalism
24
![Page 56: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/56.jpg)
Proving the formalism
24
![Page 57: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/57.jpg)
Proving the formalism
25
![Page 58: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/58.jpg)
Proving the formalism
25
![Page 59: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/59.jpg)
Proving the formalism
25
![Page 60: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/60.jpg)
Proving the formalism
25
![Page 61: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/61.jpg)
Correctness of the formalism
26
B
A
C
D
A’
B’
C’
= A Where:
= A’
![Page 62: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/62.jpg)
Correctness of the formalism
26
B
A
C
D
A’
B’
C’
= A Where:
= A’
![Page 63: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/63.jpg)
Correctness of the formalism
27
B
A
C
D
A’
B’
C’
![Page 64: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/64.jpg)
Correctness of the formalism
27
B
A
C
D
A’
B’
C’
![Page 65: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/65.jpg)
Correctness of the formalism
27
B
A
C
D
A’
B’
C’
![Page 66: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/66.jpg)
Correctness of the formalism
28
B
A
C
D
A’
B’
C’
![Page 67: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/67.jpg)
Correctness of the formalism
28
B
A
C
D
A’
B’
C’
A’’ A’
![Page 68: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/68.jpg)
Correctness of the formalism
28
B
A
C
D
A’
B’
C’
B’ A’, C’’ A’
![Page 69: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/69.jpg)
Correctness of the formalism
29
B
A
C
D
A’
B’
C’
A ’ D
![Page 70: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/70.jpg)
Correctness of the formalism
29
B
A
C
D
A’
B’
C’
A’ D
![Page 71: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/71.jpg)
Correctness of the formalism
30
B
A
C
A’
B’
C’
D
![Page 72: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/72.jpg)
Correctness of the formalism
30
B
A
C
A’
B’
C’
A ’ D
D
![Page 73: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/73.jpg)
Correctness of the formalism
31
B
A
C
D
A’
B’
C’
A’ ’ D
![Page 74: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/74.jpg)
Correctness of the formalism
31
B
A
C
A’
B’
C’
D
A’ ’ D
![Page 75: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/75.jpg)
Correctness of the formalism
32
B
A
C
D
A’
B’
C’
![Page 76: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/76.jpg)
Correctness of the formalism
32
B
A
C
D
A’
B’
C’
![Page 77: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/77.jpg)
Correctness of the formalism
32
B
A
C
D
A’
B’
C’
![Page 78: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/78.jpg)
Summary
• Shallow is too shallow.
• Deep is too deep.
• Sheep = shallow + deep.
• Formalised sheep cloning.
• Proved soundness and correctness.
33
![Page 79: SHEEP CLONING - GitHub Pages · Paley Li, Nicholas Cameron, and James Noble 1 . Object cloning •How do you do object cloning? 2 . Shallow cloning •Copies an object and alias the](https://reader034.vdocument.in/reader034/viewer/2022051608/603cb89faa386510522bc2f7/html5/thumbnails/79.jpg)
Thank you.
Questions?
34