Smalltalk

From Computer Science Community

Jump to: navigation, search

Contents

Smalltalk is an object-oriented, dynamically typed, reflective programming language. Smalltalk was created as the language to underpin the "new world" of computing exemplified by "human–computer symbiosis."

Smalltalk introduced the notion of write once, run anywhere—and this was in 1972! 
In Smalltalk, everything is an object; all you can do is send messages to objects. Communication is your single primitive; everything is expressed in terms of that primitive.

[edit] Implementation

  • Virtual image — objects in a dependency graph.
  • Virtual machine — object allocation, garbage collection, message sending, primitive behavior.

When starting off a new project, traditionally (but not necessarily), you clone out of an existing image and make transformations along the way.

[edit] Syntax

receiver message.

[edit] Three Types of Messages

  • Unary
    • e.g., Object size.
    • e.g., 3 factorial.
  • Binary
    • e.g., 3 + 4
      3 is the receiver.
      +4 is the message.
      + is the selector.
      4 is the argument.
  • Keyword (for one or more arguments)
    • e.g., Array size: 3.
      Array is the receiver.
      size: 3 is the message.
      size: is the selector.
      3 is the argument.
    • e.g., anArray at: 1 put: $A.
      anArray is the receiver.
      at: 1 put: $A is the message.
      at:put: is the selector.
      1 and $A are the arguments.

[edit] Five Keywords

  • nil — the single instance of the undefined object. (There are never uninitialized references in Smalltalk.) Cf. Null Object Pattern.
  • true — the single instance of truth.
  • false — the single instance of false.
  • self
  • super

[edit] Two Operators

  • := is assignment.
  • ^ for returning a value.

[edit] Other

  • Blocks
  • Cascaded messages (syntactic sugar)

[edit] Environment

  • Transcript
  • Workspace
  • Browser

[edit] Projects

[edit] Readings

[edit] Other

Personal tools
services