The document discusses the Self programming language, which simplifies Smalltalk by removing classes and instead using cloning and modification of objects. Fields and methods are represented as slots within objects. Lookup follows parent slots to enable dynamic inheritance without classes. Composition differs from dynamic inheritance in that inheritance follows parent slots while maintaining the receiver. Dynamic and static inheritance may both be generalized under a single concept.
2. Self
”More Smalltalk than Smalltalk”
Michal P´se (CTU in Prague)
ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 2/7
3. Self
”More Smalltalk than Smalltalk”
Goal: to simplify the language as much as possible
Michal P´se (CTU in Prague)
ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 2/7
4. Results
Fields and methods are slots
Michal P´se (CTU in Prague)
ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 3/7
5. Results
Fields and methods are slots
No classes, only cloning and modification
Michal P´se (CTU in Prague)
ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 3/7
6. Results
Fields and methods are slots
No classes, only cloning and modification
Dynamic inheritance
Michal P´se (CTU in Prague)
ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 3/7
7. Dynamic Inheritance
Some slots may be marked parent slots.
Lookup algorithm traverses these slots.
Even when invoking a method found in a different object, the receiver
does not change.
Michal P´se (CTU in Prague)
ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 4/7
8. The Little Differences
See the following patterns: singleton, proxy, chain of responsibility, state
and strategy.
Michal P´se (CTU in Prague)
ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 5/7
9. Let’s Look at Dynamic Inheritance Once More
How is it different from composition?
Michal P´se (CTU in Prague)
ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 6/7
10. Let’s Look at Dynamic Inheritance Once More
How is it different from composition?
How is it different from ”static” inheritance?
Michal P´se (CTU in Prague)
ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 6/7
11. Let’s Look at Dynamic Inheritance Once More
How is it different from composition?
How is it different from ”static” inheritance?
Perhaps there exists a concept generalizing both?
Michal P´se (CTU in Prague)
ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 6/7
12. See
James Noble and Brian Foote. Attack of the clones. In Proceedings of
the 2002 conference on Pattern languages of programs - Volume 13
(CRPIT ’02) (2002), 99–114.
Michal P´se (CTU in Prague)
ıˇ Object Programming Lect. 13: Prototype Languages December 21, 2010 7/7