View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

FAQ

Please add new questions here. They will be moved below as soon as a reasonable answer is found for them.

  • You say Self is like Smalltalk. Then why does it look like Lisp?
  • If Self is about "the power of simplicity", please explain "power" and "simplicity".

Frequently Asked Questions about Self:


Answers:

What is Self?

Self is a prototype based, object oriented programming language created by David Ungar and Randall Smith (initially at Stanford/Xerox Parc, later at Sun Microsystems).

Is it like C++ or Java?

"Self is like Smalltalk, only more so."

See a short introduction.

What is a prototype based language?

A key concept in the most widely used object-oriented programming languages is the "class". Every object belongs to a class (which may or may not also be an object) which
  • can create other objects like it
  • defines the "shape" of the object (the set of instance variables or properties)
  • defines the behavior of the object as a list of "methods"
Another way to create objects is to send a "copy" message to existing objects. So we don't really need classes for the first functionality if we keep around a set of "prototype" objects from which we can get all the copies we need. And by simply saying that each object defines itself we don't need the second nor the third functions of the class and can eliminate the concept from the language design.

In class based languages we can have incremental programming by allowing a class to "inherit" things from a superclass. If we only have objects we can get the same effect by allowing them to "delegate" to other objects things that they don't implement locally. This encourages putting shared behavior in separate objects which look suspiciously like classes. The difference is that they are used only where needed, not everywhere. Many Design Patterns are implemented more naturally with prototypes than with classes.

Is it Free or Open Source?

The main implementation of Self, Self 4.1.4, was released by Sun under a BSD-like license for the Sparc and PowerMac and has been ported to Linux x86 under the GPL. Other implementations are available, and every one of them has been free so far.

Where can I get it?

See the list of implementations on the Self Swiki home page.

Wasn't Self supposed to have some super advanced compiler technology? Why is it so slow, then?

There is a lot of confusion about this.

The famous Self compiler that ran numerical benchmarks at 50% the speed of optimized C was introduced in Self 2.0 and was created by Craig Chambers. The result is simply amazing when you consider that C does no index or overflow checking and had a far better code generator. Craig's compiler was a huge leap forward in type analysis and he has continued this work in his Vortex Compiler project (for the Modula 3 and Cecil languages). The problem was that compilation was slow and so interactive use of Self 2 wasn't very nice. The compiler didn't do such a great job in highly polymorphic (very OO styled) benchmarks.

In Self 3 and 4 an entirely different direction was taken by Urs
Hölzle. Two simple compilers replaced the complex one used previously,
and type analysis was replaced with type feedback. The first compiler
(NIC, the Non Inlining Compiler) did a quick and dirty job that allowed code to start running. Data structures called PICs (Polymorphic Inline Caches) improved the performance of message sending and, as a side effect, collected information about the types of objects actually used in the various call sites in the code. When a given method was identified as being critical to system performance (a "hot spot", hence the name of the technology given at Animorphics and included in Java 2) the second compiler (SIC, the Simple Inlining Compiler) was called to generate much better code. Though the type information available in the PICs was just a subset of what could be obtained with type analysis, it was good enough for the SIC to do a good job very quickly.

This new system did a better job on real applications and is far better for interactive use, but it doesn't get the fantastic benchmark results that Self 2 did.

When porting Self to a new system, you can get it running by just
implementing the NIC. Performance will be terrible since no inlining or type feedback will be used and these two are the key technologies in Self. For example, a simple "[...] whileTrue: [...]" will involve many message sends and block context creations per loop. Contrast that with Squeak where the compiler will generate optimized jump bytecodes instead.

Unfortunately, neither the Power Mac nor the Linux PC ports implement
the SIC, yet. David Ungar says performance is good enough on his
PowerBook and a previous version (4.1.2) seemed almost reasonable on a
233 MHz iMac. The current version (4.1.4) is supposed to improve
performance, but it seemed very slow on the 600 MHz iBook I tried it on (it wouldn't run on the iMac's OS 8.6).

Isn't Self dead? Didn't it fail?

The Self project was officially cancelled by Sun in mid 1995 to "make room" for Java. As Free software, however, it can't really die as long as at least one person is interested in it.

Some information about the history of Self would really help put this issue in perspective.

The Self project was started at Xerox Parc in 1986 by Randall Smith and, from Stanford, David Ungar. They publised a paper describing their design at OOSPLA'87. By 1990 Dave and his graduate students at Stanford had put together a working implementation (which few people had believed possible).

The whole group moved to Sun Labs in 1991. Self 2.0 was released in mid 1992, Self 3.0 in late 1993 and Self 4.0 in mid 1995, right before the project was cancelled. All of these systems only ran on Sun's own Sparc computers [Self 1.0 ran on 680x0 based Sun 3 machines. I don't know when support for those was dropped]. Some Self related work continued after that: the Kansas GUI was used as a base for a distance learning project and Java was implemented on top of Self provoking additional improvements in the virtual machine.

In late 1999 Gordon Cichon started porting Self to Linux on Intel processors and in late 2000 David Ungar released Self 4.1 which included a PowerMac port and the changes that had been done after 1995. In late 2001 Harald Gliebe continued Gordon's work and released a usable port for Linux.

While the sources for Self were available, there were several efforts from 1995 on to create independent implementations of the language:
  • tinySelf 0 and tinySelf 1
  • OpenSelf
  • JSelf
  • DSelf
  • two or three Self-on-Smalltalk projects

So the short answer is: Self didn't really die in 1995 nor has it failed in any way except for a lack of availability on popular machines.