![Page 1: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/1.jpg)
the power of simplicitySELF
Rolph Recto + Jonathan DiLorenzo
Great Works in PL
April 30, 2019
![Page 2: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/2.jpg)
2
SELF: The Power of SimplicityDavid Ungar, StanfordRandall B. Smith, Xerox PARC
OOPSLA 87
![Page 3: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/3.jpg)
3
Smalltalk-80
Simula67
Self
Javascript
Java
C++
Dahl and Nygaard
Kay, Ingalls, and Goldberg
Stroustrup
Ungar and Smith
Eich
Gosling, Sheridan, and Naughton
1995
1991
1987
1985
1980
1967
![Page 4: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/4.jpg)
4
Is JavaScript popular? It’s hard to say. Some Ajax developers profess (and demonstrate) love for it. Yet many curse it, including me. I still think of it as a quickie love-child of C and Self.
Brendan Eichhttps://brendaneich.com/2008/04/popularity/
![Page 5: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/5.jpg)
5
everything is an object
all interactions are message
passing
prototypes, not classes
principles of Self
![Page 6: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/6.jpg)
6
Smalltalk
everything isan object
methods and closures
controlstructures
primitive values
classes
![Page 7: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/7.jpg)
((4 fac) between: 10 And: 100) ifTrue: “Hi!” False: ”Bye!”
7
call “ifTrue:False:” on true with args “Hi!” and “Bye!”, return “Hi!”
call “fac” method on 4, return 24
call “between:And:” on 24 with args 10 and 100, return true
![Page 8: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/8.jpg)
8
Smalltalk Self
objects are instances of classes
objects are clonesof prototypes
![Page 9: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/9.jpg)
9
Smalltalk Self
objects are instances of classes
objects are clonesof prototypes
C++
Java Javascript
![Page 10: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/10.jpg)
10
classes prototypes
can modify methods only by subclassing
objects can have unique methods and fields
create objects by calling class constructor
create objects by cloning prototype
classes need metaclasses, etc. (infinite regress!)
no classes,no infinite regress
![Page 11: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/11.jpg)
11
classes p := (Point new) x: 7 y: 9p print
follow p’s class pointer, check if print is defined there
not defined there, so follow superclass pointer
found “print” in Object class! Invoke with receiver “p”
![Page 12: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/12.jpg)
12
classes p := (Point new) x: 1 y: 10p print
follow p’s class pointer, check if print is defined there
not defined there, so follow superclass pointer
found “print” in Object class! Invoke with receiver “p”
to have different print method, need to create Point subclass
![Page 13: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/13.jpg)
13
prototypes p:= (point clone) x: 7 y: 9p print
does p have print method? no, so follow parent pointer to delegate
does Point delegate have “print”? no, so follow parent pointer to delegate
does Object delegate have print? yes, invoke with “p” as receiver
![Page 14: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/14.jpg)
14
prototypes p:= (point clone) x: 1 y: 10p print
does p have print method? no, so follow parent pointer to delegate
does Point delegate have “print”? no, so follow parent pointer to delegate
does Object delegate have print? yes, invoke with “p” as receiver
to have special print method for p, define new slot in p -- no subclass needed!
![Page 15: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/15.jpg)
method invocation clones prototype activation record
15
activation as cloning
![Page 16: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/16.jpg)
16
state as behavior
field access and assignment are
messages to current receiver (self)
![Page 17: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/17.jpg)
17
state as behavior
p x // p.x
p x: 2 // p.x = 2
![Page 18: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/18.jpg)
18
example: points
traits
prototypes
root
_AddSlotsIfAbsent: (| traits = (). prototypes = ().|)
![Page 19: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/19.jpg)
19
example: points
traits
prototypes
root
cloneablecopy _Clone
traits _AddSlotsIfAbsent:(|cloneable=()|)traits cloneable _Define:(| copy = (_Clone).|)
![Page 20: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/20.jpg)
20
example: points
traits
prototypes
root
cloneable
point
copy _Clone
parent*
printString [method]
+ [method]
- [method]
traits _AddSlotsIfAbsent: (|point=()|)traits point _Define:(| parent* = traits cloneable. printString = … + aPoint = … - aPoint = …|)
![Page 21: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/21.jpg)
21
example: points
traits
prototypes
root
cloneable
pointpoint
copy _Clone
parent*
printString [method]
+ [method]
- [method]
parent*
x 0
x: ⇐
y 0
y: ⇐
prototypes _AddSlotsIfAbsent (|point=()|)prototypes point _Define:(| parent* = traits point. x <- 0. y <- 0.|)
![Page 22: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/22.jpg)
22
example: points
traits
prototypes
root
cloneable
pointpoint
copy _Clone
parent*
printString [method]
+ [method]
- [method]
((prototypes point) copy) x: 3 y: 4
parent*
x 3
x: ⇐
y 4
y: ⇐
parent*
x 0
x: ⇐
y 0
y: ⇐
![Page 23: the power of simplicity · the power of simplicity SELF Rolph Recto + Jonathan DiLorenzo Great Works in PL April 30, 2019. 2 SELF: The Power of Simplicity David Ungar, Stanford Randall](https://reader033.vdocument.in/reader033/viewer/2022052011/602717d6d525226df309a643/html5/thumbnails/23.jpg)
23
discussion
is Self a good influence on modern languages?
are there cases when simplicity should be
abandoned?
what are the tradeoffs of Self’s flexibility?