130 likes | 354 Views
Smalltalk. Aaron Bloomfield CS 415 Fall 2005. Evolution of Smalltalk. Alan Kay – grad student at Utah Dynabook Xerox PARC. Influenced by Lisp, Simula, Ivan Sutherland’s Sketchpad, LOGO, Dewey, Montessori, Piaget . Smalltalk. Interpreted Everything is an object
E N D
Smalltalk Aaron Bloomfield CS 415 Fall 2005
Evolution of Smalltalk • Alan Kay – grad student at Utah • Dynabook • Xerox PARC. • Influenced by Lisp, Simula, Ivan Sutherland’s Sketchpad, LOGO, Dewey, Montessori, Piaget
Smalltalk • Interpreted • Everything is an object • Dynamically & Strongly Typed • Rich programming environment • Window-oriented display management • Mouse, Menus • Example of a pure Object-Oriented Language
Smalltalk and Squeak • Smalltalk – commercial product • Squeak – free version, used for education
Bindings x <- 3 x <- x + 1 In Squeak, write <-as underscore OR := X is bound to 4
Objects and Messages • Everything is an Object • Everything is done by sending messages to objects x * 2 • Sends the message *2 to the object x.
Other Examples 3 + 2 * 5
Inheritance • Superclass • Subclass • Object • Overriding • No multiple Inheritance
Implementation • Mostly written in Smalltalk • Main loop: true whileTrue: [Display put: user run] Class - userTask run || Keyboard read eval print
Virtual Machine • Storage Manager • Interpreter • Primitive Subroutines
Storage Manager • Collects and manages free space • Handles requests to: • Create new objects • Fetch class of an object • Fetch and store fields of an object • Uses reference counting
Concurrency • Easy to implement • Handy for simulations • Each activation record is a Smalltalk object sched map: [:Task | Task run]