Presentation is loading. Please wait.

Presentation is loading. Please wait.

Aaron Bloomfield CS 415 Fall 2005

Similar presentations


Presentation on theme: "Aaron Bloomfield CS 415 Fall 2005"— Presentation transcript:

1 Aaron Bloomfield CS 415 Fall 2005
Smalltalk Aaron Bloomfield CS 415 Fall 2005

2 Evolution of Smalltalk
Alan Kay – grad student at Utah Dynabook Xerox PARC. Influenced by Lisp, Simula, Ivan Sutherland’s Sketchpad, LOGO, Dewey, Montessori, Piaget Alan Kay at Utah in late 60s

3

4 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

5 Smalltalk and Squeak Smalltalk – commercial product
Squeak – free version, used for education Smalltalk-80 was developed at Xerox (PARC in the 1970s. ) -VM written in assembly Apple obtained a license in A team at (Apple developed Squeak in 1996), and have made it available free under license. Squeak – VM is written in smalltalk, highly portable implementation of Smalltalk-80 (current developers are at Disney – Alan Kay is still part of that. but it is free and anyone can modify it.) Folks – Mark Guzdial at GA Tech

6 Bindings x <- 3 x <- x + 1
In Squeak, write <-as underscore OR := X is bound to 4

7 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.

8 Other Examples 3 + 2 * 5 25 is answer (use parenthesis if you want 13)
Precedence is left to right within same message type. Unary-> binary-> keyword (new) (math ops) (newAt:) [This example uses all binary operators.] Parenthesis override UNDERSCORE is the <- assignment in Squeak Alt-P to execute “this is a comment” Transcript show: ‘Hello World’

9 Inheritance Superclass Subclass Object Overriding
No multiple Inheritance Object is the class that everything inherits from If you create a new class it will be a subclass of Object. Simulation is the mode of programming

10 Implementation Mostly written in Smalltalk Main loop:
true whileTrue: [Display put: user run] Class - userTask run || Keyboard read eval print (Compiler, debugger, decompiler, editor, file system = 97% of code.) Even activation records are smalltalk objects. Smalltalk-80 – VM – written in assembly (except for Squeak – written in Smalltalk, with an translator into C) Infinite loop – executes stuff in block. Sends the run mesg to user task.

11 Virtual Machine Storage Manager Interpreter Primitive Subroutines
Interpreter – operates on an intermediate language (the operations of the smalltalk virtual machine) Prim. Subroutines – collection of methods that for performance reasons are impelemented in assembly. (I/O, integer arithemtic)

12 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

13 Concurrency Easy to implement Handy for simulations
Each activation record is a Smalltalk object sched map: [:Task | Task run] If sched is a set of tasks, then map will map the block [] to sched. [] needs to be something that will take a task and send it the run message. Like map in Scheme


Download ppt "Aaron Bloomfield CS 415 Fall 2005"

Similar presentations


Ads by Google