Self (programming language): Difference between revisions

Content deleted Content added
Citation bot (talk | contribs)
Add: s2cid, isbn, year, journal, authors 1-2. Removed parameters. Some additions/deletions were parameter name changes. | Use this bot. Report bugs. | Suggested by RoanokeVirginia | Category:Programming languages | #UCB_Category 146/200
OAbot (talk | contribs)
m Open access bot: url-access updated in citation with #oabot.
 
(33 intermediate revisions by 19 users not shown)
Line 1:
{{Short description|Prototype-based programming language}}
{{Infobox programming language
| name = Self
| logo = [[File:Self-logo.svg|200px|Logo]]
| logo size = 200px
| paradigm = [[Object-oriented programming|object-oriented]] ([[prototype-based programming|prototype-based]])
| logo caption = Self logo
| year = {{Start date and age|1987}}
| screenshot = <!-- Filename -->
| designer = [[David Ungar]], Randall Smith
| screenshot caption =
| developer = David Ungar, Randall Smith, [[Stanford University]], [[Sun Microsystems]]
| paradigmparadigms = [[Object-oriented programming|object-oriented]] ([[prototypePrototype-based programming|prototype-based]])
| latest release version = Mandarin 2017.1
| family = [[Smalltalk]]
| latest release date = {{Start date and age|2017|05|24}}
| designerdesigners = [[David Ungar]], Randall Smith
| typing = [[Type system|dynamic]], [[Strongly-typed programming language|strong]]
| developerdevelopers = David Ungar, Randall Smith, <br/>[[Stanford University]], <br/>[[Sun Microsystems]]
| yearreleased = {{Start date and age|1987}}
| latest release version = Mandarin 20172024.1
| latest release date = {{Start date and age|20172024|0508|2428}}
| typing = [[Type system|dynamic]], [[Strongly-typedStrong programmingand languageweak typing|strong]]
| operating system = [[Cross-platform software|Cross-platform]]: [[Unix-like]], [[macOS]], [[Microsoft Windows|Windows]]
| license = [[BSD licenses|BSD]]-like license
| website = {{URL|www.selflanguage.org}}
| implementations = Self
| dialects =
| influenced_byinfluenced by = [[Smalltalk]], [[APL (programming language)|APL]]<ref>{{cite journalconference|doi=10.1145/1238844.1238853|titlelast1=SelfUngar|journalfirst1=David|last2=Smith|first2=Randall B.|book-title=Proceedings of the Thirdthird ACM SIGPLAN Conferenceconference on History of Programmingprogramming Languageslanguages (HOPL III)|yeartitle=2007Self |last1date=Ungar|first1=David|last2=Smith|first2=Randall2007 B.|isbn=9781595937667|s2cid=220937663}}</ref>
| influenced = [[NewtonScript]], [[JavaScript]], [[Io (programming language)|Io]], [[Agora (programming language)|Agora]], [[Squeak]], [[Lua (programming language)|Lua]], [[Factor (programming language)|Factor]], [[REBOLRebol]]
| operating_system =
| license = BSD-like license
| website = {{URL|www.selflanguage.org}}
}}
 
'''Self''' is ana [[objectGeneral-orientedpurpose programming language|general-purpose]], [[High-level programming language|high-level]], [[Object-oriented programming|object-oriented]] [[programming language]] based on the concept of ''[[Prototype-based programming|prototypes]]''. Self began as a dialect of [[Smalltalk]], being [[dynamically typed]] and using [[just-in-time compilation]] (JIT) as well aswith 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. The latest version, is 20172024.1 was released in MayAugust 20172024.<ref>{{cite web |title=Self "Mandarin" 2017.1|url=https://blog.selflanguage.org/2017/05/24/self-mandarin-2017-1/|date=24 May 2017|access-datewebsite=24[[GitHub]] May 2017|archive-url=https://webgithub.archive.orgcom/webrussellallen/20170524053153self/https:releases/tag/blog2024.selflanguage.org/2017/05/24/self-mandarin-2017-1/ |archive-date=24 May 2017 |urlaccess-statusdate=dead1 November 2024}}</ref>
 
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 (programming language)|C]]. Much of the development of Self took place at [[Sun Microsystems]], and the techniques they developed were later deployed for [[Java (programming language)|Java]]'s [[HotSpot (virtual machine)|HotSpot]] [[virtual machine]].
 
At one point a version of Smalltalk was implemented in Self. Because it was able to use the JIT, this also gave extremely good performance.<ref>{{cite journalconference |last1=Wolczko |first1=Mario |date=1996 |title=self includes: Smalltalk |journalconference=Workshop on Prototype-Based Languages, ECOOP '96, |place=Linz, Austria|date=1996}}</ref>
 
== History ==
Self was designed mostly by [[David Ungar]] and Randall Smith in 1986 while working at [[PARC (company)|Xerox PARC]]. Their objective was to push forwardadvance the state of the art in object-oriented programming language research, once [[Smalltalk|Smalltalk]]-80]] was released by the labs and began to be taken seriously by the industry. They moved to [[Stanford University]] and continued work on the language, building the first working Self compiler in 1987. At that pointThen, focus changed to attemptingworking to bringbuild upa an entirefull system for Self, asin opposedcontrast to justonly 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. Several new releases followed until falling largely dormant in 1995 with theversion 4.0. In 2006, version. The 4.3 version was released, in 2006 and ran onfor [[macOS|Mac OS X]] and [[Oracle Solaris (operating system)|Solaris]]. Ain 2010, a new release, inversion 20104.4,<ref>{{cite web |title=Self 4.4 released |url=https://blog.selflanguage.org/2010/07/16/self-4-4-released/ |date=16 July 2010 |access-date=24 May 2017 |url-status=dead |archive-url=https://web.archive.org/web/20171205194557/https://blog.selflanguage.org/2010/07/16/self-4-4-released/ |archive-date=5 December 2017|url-status=dead}}</ref> version 4.4, has beenwas developed by a group comprising some of the original team and independent programmers and is available, for Mac OS X and [[Linux]], as are all followinglater versions. TheIn January 2014, a follow-up, 4.5 was released in January 2014,<ref>{{cite web |title=Self Mallard (4.5.0) released |url=http://blog.selflanguage.org/2014/01/12/self-mallard-4-5-0-released/ |date=12 January 2014 |access-date=24 May 2017 |url-status=dead |archive-url=https://web.archive.org/web/20171206074534/https://blog.selflanguage.org/2014/01/12/self-mallard-4-5-0-released/ |archive-date=6 December 2017|url-status=dead}}</ref> and three years later, version 2017.1 was released in May 2017.
 
The [[Morphic (software)|Morphic]] [[user interface]] construction environment was originally developed by Randy Smith and John Maloney for the Self programming language.<ref>{{cite conference |last1=Maloney |first1=John H. |last2=Smith |first2=Randall B. |book-title=Proceedings of the 8th annual ACM symposium on User interface and software technology |title=Directness and liveness in the morphic user interface construction environment |date=1995 |pages=21–28 |doi=10.1145/215585.215636 |isbn=089791709X |s2cid=14479674 |url=http://bibliography.selflanguage.org/directness.html |access-date=24 March 2020|url-access=subscription }}</ref> Morphic has been ported to other notable programming languages including [[Squeak]], [[JavaScript]], [[Python (programming language)|Python]], and [[Objective-C]].
The first public release was in 1990, and the next year the team moved to [[Sun Microsystems]] where they continued work on the language. Several new releases followed until falling largely dormant in 1995 with the 4.0 version. The 4.3 version was released in 2006 and ran on [[macOS|Mac OS X]] and [[Solaris (operating system)|Solaris]]. A new release in 2010,<ref>{{cite web|title=Self 4.4 released|url=https://blog.selflanguage.org/2010/07/16/self-4-4-released/|date=16 July 2010|access-date=24 May 2017|archive-url=https://web.archive.org/web/20171205194557/https://blog.selflanguage.org/2010/07/16/self-4-4-released/|archive-date=5 December 2017|url-status=dead}}</ref> version 4.4, has been developed by a group comprising some of the original team and independent programmers and is available for Mac OS X and [[Linux]], as are all following versions. The follow-up 4.5 was released in January 2014,<ref>{{cite web|title=Self Mallard (4.5.0) released|url=http://blog.selflanguage.org/2014/01/12/self-mallard-4-5-0-released/|date=12 January 2014|access-date=24 May 2017|archive-url=https://web.archive.org/web/20171206074534/https://blog.selflanguage.org/2014/01/12/self-mallard-4-5-0-released/|archive-date=6 December 2017|url-status=dead}}</ref> and three years later, version 2017.1 was released in May 2017.
 
Self also inspired a number of languages based on its concepts. Most notable, perhaps, were [[NewtonScript]] for the [[Apple Newton]] and [[JavaScript]] used in all modern browsers. Other examples include [[Io (programming language)|Io]], [[Lisaac]] and [[Agora (programming language)|Agora]]. The [[IBM Tivoli Framework]]'s distributed object system, developed in 1990, was, at the lowest level, a prototype based object system inspired by Self.
 
== Prototype-based programming languages ==
Line 70 ⟶ 78:
<syntaxhighlight lang="smalltalk">'Hello, World!' print.</syntaxhighlight>
 
This is the Self version of the [[hello"Hello, world]]World!" program]]. The <code>'</code> syntax indicates a literal string object. Other literals include numbers, blocks and general objects.
 
Grouping can be forced by using parentheses. In the absence of explicit grouping, the unary messages are considered to have the highest precedence followed by binary (grouping left to right) and the keywords having the lowest. The use of keywords for assignment would lead to some extra parenthesis where expressions also had keyword messages, so to avoid that Self requires that the first part of a keyword message selector start with a lowercase letter, and subsequent parts start with an uppercase letter.
Line 84 ⟶ 92:
And: ((base top) / (scale factor))).</syntaxhighlight>
 
In Smalltalk-80, the same expression would lookbe written as:
 
<syntaxhighlight lang="smalltalk">valid := self base bottom
Line 105 ⟶ 113:
=== Delegation ===
{{main|Delegation (object-oriented programming)}}
In theory, every Self object is a stand-alone entity. Self has neither classes nor meta-classes. Changes to a particular object do not affect any other, but in some cases it is desirable if they did. Normally an object can understand only messages corresponding to its local slots, but by having one or more slots indicating ''parent'' objects, an object can '''delegate''' any message it does not understand itself to the parent object. Any slot can be made a parent pointer by adding an asterisk as a suffix. In this way Self handles duties that would use [[inheritance (computerobject-oriented scienceprogramming)|inheritance]] in class-based languages. Delegation can also be used to implement features such as [[namespace]]s and [[lexical scoping]].
 
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. This is a prototype, which is only special in the way it is used since it also happens to be a fully functional bank account.
Line 151 ⟶ 159:
 
===Performance===
Self VMs achieved performance of approximately half the speed of optimised C on some benchmarks.<ref>{{cite webjournal |url=http://research.sun.com/jtech/pubs/97-pep.ps |title=Design and Implementation of Pep, a Java Just-In-Time Translator |last1=Agesen |first1=Ole |journal=Theory and Practice of Object Systems |volume=3 |issue=2 |date=March 1997 |websitepages=sun127–155 |doi=10.com1002/(SICI)1096-9942(1997)3:2<127::AID-TAPO4>3.0.CO;2-S |archive-url=https://web.archive.org/web/20061124224739/http://research.sun.com/jtech/pubs/97-pep.ps |archive-date=November 24, 2006 |url-status=dead|url-access=subscription }}</ref>
 
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.
Line 159 ⟶ 167:
 
===Optimizations===
The run time system selectively flattens call structures. This gives modest speedups in itself, but allows extensive caching of type information and multiple versions of code for different caller types. 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.<ref>[http{{cite thesis |url=https://www.sunlabscs.comtufts.edu/research~nr/selfcs257/papersarchive/chamberscraig-thesischambers/thesis.ps.Zpdf ]|title=The {{deadDesign and Implementation of the SELF Compiler, an Optimizing Compiler for Object-Oriented Programming Languages link|datefirst=JuneCraig 2016|botlast=medic}}{{cbignoreChambers |botpublisher=medic[[Stanford University]] |degree=PhD |date=March 13, 1992}}</ref>
 
==See also==
* [[Morphic (software)]]
* [[Cecil (programming language)]]
 
Line 172 ⟶ 181:
| first1= C. |last1= Chambers
| year=1992
| title = The Design and Implementation of the SELFSelf Compiler, an Optimizing Compiler for Object-Oriented Programming Languages
| citeseerx = 10.1.1.30.1652
| publisher=[[Stanford University]]
Line 179 ⟶ 188:
 
==External links==
{{External links|date=August 2013}}
* {{Official website|www.selflanguage.org}}
* {{githubGitHub|russellallen/self}}
* [https://web.archive.org/web/20020606124955/http://research.sun.com/self/ Former Self Home Page at Sun Microsystems]
* [https://web.archive.org/web/20070503053204/http://www.cs.ucsb.edu/~urs/oocsb/self/papers/papers.html Alternate source of papers on Self from UCSB (mirror for the Sun papers page)]
* [https://web.archive.org/web/20050427111747/http://www.merlintec.com/lsi/ Merlin Project]
* [https://web.archive.org/web/20030613141004/http://gliebe.de/self/index.html Self ported to Linux (without many optimizations)]
* [http://selfguru.sourceforge.net/ Automated Refactoring application on sourceforge.net, written for and in Self]
* [http://www.self-support.com/ Gordon's Page on Self]
* [http://community.schemewiki.org/?prometheus Prometheus object system on the Community Scheme Wiki]
* [https://web.archive.org/web/20060813135539/http://www.smalltalk.org.br/movies/ Video demonstrating self]
* [http://www.ag-nbi.de/research/dself/ dSelf: distributed extension to the delegation and language Self]
 
{{Smalltalk programming language}}
Line 200:
[[Category:Object-oriented programming languages]]
[[Category:Prototype-based programming languages]]
[[Category:Software using the BSD license]]
[[Category:Cross-platform free software]]
[[Category:Free compilers and interpretersopen source compilers]]
[[Category:Programming languages created in 1987]]
[[Category:1987 software]]
<!-- Hidden categories below -->
[[Category:Articles with example Smalltalk code]]