Self (programming language)

Self is a general-purpose, high-level, object-oriented programming language based on the concept of prototypes.

Self began as a dialect of Smalltalk, being dynamically typed and using just-in-time compilation (JIT) with the prototype-based approach to objects: it was first used as an experimental test system for language design in the 1980s and 1990s.

In 2006, Self was still being developed as part of the Klein project, which was a Self virtual machine written fully in Self.

[2] Several just-in-time compilation techniques were pioneered and improved in Self research as they were required to allow a very high level object oriented language to perform at up to half the speed of optimized C. Much of the development of Self took place at Sun Microsystems, and the techniques they developed were later deployed for Java's HotSpot virtual machine.

[3] Self was designed mostly by David Ungar and Randall Smith in 1986 while working at Xerox PARC.

Their objective was to advance the state of the art in object-oriented programming language research, once Smalltalk-80 was released by the labs and began to be taken seriously by the industry.

Then, focus changed to working to build a full system for Self, in contrast to only the language.

The first public release was in 1990, and the next year the team moved to Sun Microsystems where they continued work on the language.

The Morphic user interface construction environment was originally developed by Randy Smith and John Maloney for the Self programming language.

Traditional class-based OO languages are based on a deep-rooted duality: For example, suppose objects of the Vehicle class have a name and the ability to perform various actions, such as drive to work and deliver construction materials.

In theory one can then send a message to Bob's car, telling it to deliver construction materials.

A more useful model arises from the use of subclassing to create specializations of Vehicle; for example Sports Car and Flatbed Truck.

[citation needed] Experience with early OO languages like Smalltalk showed that this sort of issue came up again and again.

Systems would tend to grow to a point and then become very rigid, as the basic classes deep below the programmer's code grew to be simply "wrong".

So Bob's car would be created by making a copy of an existing "Vehicle" object, and then adding the drive fast method, modelling the fact that it happens to be a Porsche 911.

can be parsed unambiguously, and means the same as: In Smalltalk-80, the same expression would be written as: assuming base, ligature, height and scale were not instance variables of self but were, in fact, methods.

For example, suppose an object is defined called "bank account", that is used in a simple bookkeeping application.

Usually, this object would be created with the methods inside, perhaps "deposit" and "withdraw", and any data slots needed by them.

An earlier example was about refactoring a simple class called Vehicle in order to be able to differentiate the behaviour between cars and trucks.

The literal object that is the initial value of 'vehicle' includes a single slot so it can understand messages related to cloning.

That is, programs are not stand-alone entities as they are in languages such as C, but need their entire memory environment in order to run.

Unlike traditional systems, only the changed object has the new code, and nothing has to be rebuilt in order to test it.

Self VMs achieved performance of approximately half the speed of optimised C on some benchmarks.

[7] This was achieved by just-in-time compilation techniques which were pioneered and improved in Self research to make a high level language perform this well.

This removes the need to do many method lookups and permits conditional branch statements and hard-coded calls to be inserted- often giving C-like performance with no loss of generality at the language level, but on a fully garbage collected system.