Smalltalk

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.”[1] It was designed and created in part for educational use, more so for constructionist learning, at the Learning Research Group (LRG) of Xerox PARC by Alan Kay, Dan Ingalls, […]

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.”[1] It was designed and created in part for educational use, more so for constructionist learning, at the Learning Research Group (LRG) of Xerox PARC by Alan Kay, Dan Ingalls, Adele Goldberg, Ted Kaehler, Scott Wallace, and others during the 1970s.

The language was first generally released as Smalltalk-80. Smalltalk-like languages are in continuing active development, and have gathered loyal communities of users around them. ANSI Smalltalk was ratified in 1998 and represents the standard version of Smalltalk.[2]

Smalltalk-80 is a totally reflective system, implemented in Smalltalk-80 itself. Smalltalk-80 provides both structural and computational reflection. Smalltalk is a structurally reflective system whose structure is defined by Smalltalk-80 objects. The classes and methods that define the system are themselves objects and fully part of the system that they help define. The Smalltalk compiler compiles textual source code into method objects, typically instances of CompiledMethod. These get added to classes by storing them in a class’s method dictionary. The part of the class hierarchy that defines classes can add new classes to the system. The system is extended by running Smalltalk-80 code that creates or defines classes and methods. In this way a Smalltalk-80 system is a “living” system, carrying around the ability to extend itself at run time.

Since the classes are themselves objects, they can be asked questions such as “what methods do you implement?” or “what fields/slots/instance variables do you define?”. So objects can easily be inspected, copied, (de)serialized and so on with generic code that applies to any object in the system.

Smalltalk-80 also provides computational reflection, the ability to observe the computational state of the system. In languages derived from the original Smalltalk-80 the current activation of a method is accessible as an object named via a pseudo-variable (one of the six reserved words), thisContext. By sending messages to thisContext a method activation can ask questions like “who sent this message to me”. These facilities make it possible to implement co-routines or Prolog-like back-tracking without modifying the virtual machine. The exception system is implemented using this facility. One of the more interesting uses of this is in the Seaside web framework which relieves the programmer of dealing with the complexity of a Web Browser’s back button by storing continuations for each edited page and switching between them as the user navigates a web site. Programming the web server using Seaside can then be done using a more conventional programming style.

When an object is sent a message that it does not implement, the virtual machine sends the object the doesNotUnderstand: message with a reification of the message as an argument. The message (another object, an instance of Message) contains the selector of the message and an Array of its arguments. In an interactive Smalltalk system the default implementation of doesNotUnderstand: is one that opens an error window (a Notifier) reporting the error to the user. Through this and the reflective facilities the user can examine the context in which the error occurred, redefine the offending code, and continue, all within the system, using Smalltalk-80′s reflective facilities.

Another important use of doesNotUnderstand: is intercession. One can create a class that does not define any methods other than doesNotUnderstand: and does not inherit from any other class. The instances of this class effectively understand no messages. So every time a message is sent to these instances they actually get sent doesNotUnderstand:, hence they intercede in the message sending process. Such objects are called proxies. By implementing doesNotUnderstand: appropriately, one can create distributed systems where proxies forward messages across a network to other Smalltalk systems (a facility common in systems like CORBA, COM+ and RMI but first pioneered in Smalltalk-80 in the 1980s), and persistent systems where changes in state are written to a database and the like. An example of this latter is Logic Arts’ VOSS (Virtual Object Storage System) available for VA Smalltalk under dual open source and commercial licensing.

Smalltalk-80 syntax is rather minimalist, based on only a handful of declarations and reserved words. In fact, only six “keywords” are reserved in Smalltalk: true, false, nil, self, super, and thisContext. These are actually called pseudo-variables, identifiers that follow the rules for variable identifiers but denote bindings that the programmer cannot change. The true, false, and nil pseudo-variables are singleton instances. self and super refer to the receiver of a message within a method activated in response to that message, but sends to super are looked up in the superclass of the method’s defining class rather than the class of the receiver, which allows methods in subclasses to invoke methods of the same name in superclasses. thisContext refers to the current activation record. The only built-in language constructs are message sends, assignment, method return and literal syntax for some objects. From its origins as a language for children of all ages, standard Smalltalk syntax uses punctuation in a manner more like English than mainstream coding languages. The remainder of the language, including control structures for conditional evaluation and iteration, is implemented on top of the built-in constructs by the standard Smalltalk class library. (For performance reasons, implementations may recognize and treat as special some of those messages; however, this is only an optimization and is not hardwired into the language syntax.)

Most popular programming systems separate static program code (in the form of class definitions, functions or procedures) from dynamic, or run time, program state (such as objects or other forms of program data). They load program code when a program starts, and any prior program state must be recreated explicitly from configuration files or other data sources. Any settings the program (and programmer) does not explicitly save must be set up again for each restart. A traditional program also loses much useful document information each time a program saves a file, quits, and reloads. This loses details such as undo history or cursor position. Image based systems don’t force losing all that just because a computer is turned off, or an OS updates.

Many Smalltalk systems, however, do not differentiate between program data (objects) and code (classes). In fact, classes are objects themselves. Therefore most Smalltalk systems store the entire program state (including both Class and non-Class objects) in an image file. The image can then be loaded by the Smalltalk virtual machine to restore a Smalltalk-like system to a prior state. This was inspired by FLEX,[12] a language created by Alan Kay and described in his M.Sc. thesis.

Other languages that model application code as a form of data, such as Lisp, often use image-based persistence as well.

Smalltalk images are similar to (restartable) core dumps and can provide the same functionality as core dumps, such as delayed or remote debugging with full access to the program state at the time of error.

Squeak is a modern, open source, full-featured implementation of the powerful Smalltalk programming language and environment. Squeak is highly-portable – even its virtual machine is written entirely in Smalltalk making it easy to debug, analyze, and change. Squeak is the vehicle for a wide range of projects from multimedia applications, educational platforms to commercial web application development.

Noteworthy uses of Squeak

  • Etoys is a powerful script-based environment to learn science and math by encouraging exploration and experimentation.
  • Pharo is a Squeak fork that focuses on web application development. The Seaside development team does its development work on Pharo.
  • Cuis is a free Smalltalk-80 environment originally derived from Squeak with a specific set of goals: being simple and powerful.
  • Seaside is a web framework for developing complex dynamic web applications which by leveraging the Smalltalk strengths considerably ease the web application development.
  • Aida/Web is the web framework used to make this site.
  • Scratch is a new programmable toolkit that enables kids to create their own games, animated stories, and interactive art — and share their creations with one another over the Net. Scratch builds on the tradition of Logo and LEGO/Logo, but takes advantage of new computational ideas to make it easier to get started with programming (lowering the floor) and extend the range of what kids can create and learn (raising the ceiling).

See our Projects page for more!

The Squeak community is friendly and active. Here is a short list of resources that you may find useful:
www.surfscranton.com/architecture/KnightsPrinciples.htm

www.squeak.org
is the main web site of Squeak. (Do not confuse it with www.squeakland.org which is dedicated to the eToy environment built on top of Squeak but whose audience is elementary school teachers.)

www.squeaksource.com
is the equivalent of SourceForge for Squeak projects.

wiki.squeak.org/squeak
is a wiki with up-to-date information about Squeak.
About mailing-lists.
There are a lot of mailing-lists and sometimes they can be just a little bit too active. If you do not want to get flooded by mail but would still like to participate we suggest you to use
news.gmane.org
or
www.nabble.com/Squeak-f14152.html
to browse the lists.
You can find the complete list of Squeak mailing-lists at
lists.
squeakfoundation.org/mailman/listinfo
.
Note that Squeak-dev refers to the developers’ mailing-list, which can be browsed here:
news.gmane.org/gmane.comp.lang.smalltalk.squeak.general

Newbies
refers to a friendly mailing-list for beginners where any question can be asked:
news.gmane.org/gmane.comp.lang.smalltalk.squeak.beginners
(There is so much to learn that we are all beginners in some aspect of Squeak!)
IRC.
Have a question that you need answered quickly? Would you like to meet with other squeakers around the world? A great place to participate in longer-term discussions is the IRC channel on the “#squeak” channel at
irc.freenode.net
. Stop by and say “Hi!”
Other sites.
There are several websites supporting the Squeak community today in various ways. Here are some of them:

people.squeakfoundation.org
is the site of SqueakPeople, which is a kind of “advogato.org” for squeakers. It offers articles, diaries and an interesting trust metric system.

planet.squeak.org
is the site of PlanetSqueak which is an RSS aggregator.
It is good place to get a flood of squeaky things. This includes the latest blog entries from developers and others who have an interest in Squeak.

www.frappr.com/squeak
is a site that tracks Squeak users around the world.
Dolphin Smalltalk, or “Dolphin” for short, is an implementation of the Smalltalk programming language by Object Arts, targeted at the Microsoft Windows platform.

The last major release was Dolphin Smalltalk X6, which comes in two versions:

  • Community Edition (free)
  • Professional edition (commercial) currently in version 6.02

Dolphin is notable for its integrated development environment. The toolset of this Smalltalk dialect include an integrated refactoring browser, a package browser and a WYSIWYG “view composer”. Dolphin Smalltalk deviates from the convention of the Smalltalk MVC framework with a model-presenter-view framework.

The free community version may be one of the richest free programming environments for the Windows operating system because of the nature of the tutorials and sample applications and the rich class libraries. Other Smalltalk dialects for Windows include Smalltalk MT and the Smalltalk dialects from Cincom.