1 / 18

Self: The Power of Simplicity David Ungar and Randall B. Smith

Self: The Power of Simplicity David Ungar and Randall B. Smith. Presenter: Jonathan Aldrich 15-819. History: Smalltalk. First “modern” OO language – Alan Kay, 1970s Everything is an object (e.g., the number 15, the class List) Garbage collection Closures Exploratory programming

paulos
Download Presentation

Self: The Power of Simplicity David Ungar and Randall B. Smith

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. Self:The Power of SimplicityDavid Ungar and Randall B. Smith Presenter: Jonathan Aldrich 15-819

  2. History: Smalltalk • First “modern” OO language – Alan Kay, 1970s • Everything is an object (e.g., the number 15, the class List) • Garbage collection • Closures • Exploratory programming • Designed for kids • Dynamically typed • Add new code/evaluate exprs with no compilation required • Extraordinary development environment • 10-20 years ago, better than the best IDE today • Try it (Squeak)

  3. Self’s Simplicity • No classes (clone objects instead) • No variables (use messages) • No control structures (use polymorphism) • Everything is an object

  4. Classes Hold behavior Inherit from another class Can be instantiated Objects Hold state Are an instance of a class Prototypes Hold behavior Delegate (inherit) to another object Can be cloned Hold state Classes vs. Prototypes

  5. Classes vs. Prototypes

  6. Instantiation vs. Cloning

  7. Self Flexibility

  8. Control Structures

  9. Modeling closures • Just prototype objects • Cloned when closure is invoked • Slots for local variables • parent pointer refers to enclosing environment • For closures, just the enclosing method • For methods, set to receiver object

  10. Closures

  11. Multiple Inheritance

  12. Code Example

  13. Expressiveness • Examples in paper • Sharing state between objects • Singleton objects • Easily replace variable with method • Run-time behavior changes • Add/remove methods • Dynamic Inheritance: Add/remove/change parent links

  14. Dynamic Inheritance Example NormalController operate = { … if (badness) parent*: SafetyController … } ReactorController parent* … SafetyController restart = { … if (safe condition) parent*: NormalController … }

  15. Checking • Dynamically typed • Errors are caught at run time • This slide is largely a placeholder • Will be important part of discussion in other papers

  16. Claimed Engineering Benefits(in addition to expressiveness) • Concreteness of prototypes • Simplicity of cloning • [Eliminates infinite meta-regress of Smalltalk]

  17. Engineering Challenges • Are classes too useful to programmers to give up? • Difficulty of reasoning about dynamism • Typechecking [Andi’s research]

  18. Secret Agenda • Development of new language: Plaid • Prototype-based • Unifies objects, classes, modules • Type-safe dynamic inheritance • Other features • Multi-methods, aspects, typestate, ownership • Emphasis: safe component-based SE

More Related