LLMpediaThe first transparent, open encyclopedia generated by LLMs

Self (programming language)

Generated by DeepSeek V3.2
Note: This article was automatically generated by a large language model (LLM) from purely parametric knowledge (no retrieval). It may contain inaccuracies or hallucinations. This encyclopedia is part of a research project currently under review.
Article Genealogy
Parent: JavaScript Hop 4
Expansion Funnel Raw 64 → Dedup 0 → NER 0 → Enqueued 0
1. Extracted64
2. After dedup0 (None)
3. After NER0 ()
4. Enqueued0 ()
Self (programming language)
NameSelf
ParadigmObject-oriented, prototype-based
DesignerDavid Ungar, Randall Smith
DeveloperSun Microsystems, Stanford University
Latest release version4.5
Latest release date2017
TypingDynamic, strong
InfluencedJavaScript, NewtonScript, Io, Lua
Operating systemSolaris, macOS
LicenseBSD licenses

Self (programming language). Self is a dynamic, prototype-based object-oriented programming language and environment designed for expressive power and conceptual simplicity. It was developed in the mid-1980s at Stanford University and later at Sun Microsystems by researchers David Ungar and Randall Smith. The language is notable for its radical simplification of the Smalltalk model, eliminating the distinction between classes and objects, and for pioneering advanced just-in-time compilation techniques that later influenced modern virtual machines.

History and development

The origins of Self trace back to research at the Stanford University Programming Languages Group in 1986, led by David Ungar and Randall Smith. The project was heavily inspired by the philosophy and design of Smalltalk-80 from Xerox PARC, but sought to push the concepts of object-oriented programming to a purer extreme. In 1991, the core development team moved to Sun Microsystems' Sun Labs, where the language matured significantly. Key funding and support came from the Defense Advanced Research Projects Agency (DARPA), and the project produced several major releases throughout the 1990s. Development eventually slowed after the departure of key researchers and the shifting focus of Sun Microsystems toward Java, though an open-source community continued its maintenance.

Language features

Self's most defining feature is its exclusive use of prototype-based programming, where any object can serve as a template for creating new objects, completely eliminating the need for classes. All operations, including inheritance and code, are performed by sending messages to objects. The language employs a uniform Object model where even basic data types like Integers and Booleans are ordinary objects. It supports advanced features like slots (which can hold data or methods), first-class functions via blocks, and mirrors for reflection. This design emphasizes linguistic abstraction and encourages a style of programming focused on Composition over inheritance.

Implementation and virtual machine

The Self environment is implemented through a highly optimized Virtual machine written primarily in C. Its most significant technical contribution is the development of adaptive just-in-time (JIT) compilation, a technique later refined for the Java virtual machine at Sun Microsystems. The system featured a novel garbage collector known as the generational scavenger, and an innovative graphical programming environment with direct manipulation tools. The Self virtual machine's research on Inline caching, Dynamic recompilation, and optimization of dynamic dispatch directly influenced the design of V8 for Google Chrome and the HotSpot JVM.

Influence and legacy

Self has had a profound influence on the evolution of programming languages and systems software. Its prototype model was directly adopted by Brendan Eich for JavaScript, the core language of the World Wide Web. It also inspired the design of NewtonScript for the Apple Newton, Io, and aspects of Lua. The groundbreaking optimization work from the Self virtual machine became foundational for modern JIT compilers, heavily impacting the Java virtual machine, Microsoft's .NET Framework Common Language Runtime (CLR), and the V8 engine. Research papers on Self are frequently cited in computer science literature on Virtual machines and Object-oriented programming.

Example code

A simple Self program creates objects and sends messages. The following code, typically written in the Self environment, defines a point object and a method to calculate distance. ``` | p1 p2 | p1: (| x = 3. y = 4 |). p2: (| x = 0. y = 0 |). p1 distanceTo: p2 = ( ((x - p2 x) squared + (y - p2 y) squared) sqrt ). ``` This example shows the use of slots for data, the message send syntax, and the block for method definition, illustrating the language's consistent Object model.

Category:Prototype-based programming languages Category:Object-oriented programming languages Category:Programming languages created in 1986