Newspeak (programming language) explained

Newspeak
Paradigm:object-oriented, functional
Family:Smalltalk

Self

Designer:Gilad Bracha
Developers:Gilad Bracha, Peter von der Ahé, Vassili Bykov, Yaron Kashai, Ryan Macnak, William Maddox, Eliot Miranda
Latest Release Version:Prototype
Typing:dynamic, optional
Implementations:Primordial Soup
Influenced By:Smalltalk, Self, BETA, E
Programming Language:C++, Newspeak, JavaScript
Operating System:Windows 10, macOS, Linux, Android; web browsers
License:Apache

Newspeak is a programming language and platform in the tradition of Smalltalk and Self being developed by a team led by Gilad Bracha.[1] The platform includes an integrated development environment (IDE), a graphical user interface (GUI) library, and standard libraries.[2] Starting in 2006, Cadence Design Systems funded its development and employed the main contributors, but ended funding in January 2009.[3]

Overview

Newspeak is a class-based and message-based language. Classes may be nested, as in BETA. This is one of the key differences between Newspeak and Smalltalk.

Newspeak is distinguished by its unusual approach to modularity.[4] The language has no global namespace. Top level classes act as module declarations. Modularity in Newspeak is based exclusively on class nesting. Module declarations are first class values (i.e., they may be stored in variables, passed as parameters, returned from methods, etc.) and are stateless.

By design the newspeak lacks undeclared access to a global scope and therefore enforces dependency injection. As consequence it requires all class dependencies (instance variables referred as by "slots") to be explicitly referenced. This makes every class in Newspeak virtual. All names of dependencies in Newspeak are late-bound (dynamically bound), and are interpreted as message sends, as in Self.

A notable feature of newspeak is its impossibility to directly access instance variables. It's done via automatically generated getters or setters.

Development

While developed at Cadence Newspeak was used to write its own IDE (compiler, debugger, class browsers, object inspectors, unit testing framework, a mirror based reflection API etc.), a portable GUI tool kit, an object serializer/deserializer, a parser combinator library, a regular expression package, core libraries for collections, streams, strings and files, parts of foreign function interface and CAD application code.[5] The Newspeak platform as a whole took approximately 8 person years of work.

Identity

The name Newspeak is inspired by the Newspeak language appearing in George Orwell's dystopian novel Nineteen Eighty-Four. The heading on the programming language's website says "It's doubleplusgood". The motive for the name is that Orwell's Newspeak language grew smaller with each revision;[6] Bracha views this as a desirable goal for a programming language.

The language icon is supposed to be Big Brother's eye, as seen in page 3 of the documentation.

It should not be confused with the safety critical programming language of the same name designed by Ian Currie of RSRE in 1984, for use with the VIPER microprocessor. Its principal characteristic was that its compiler would ensure all potential exceptional behaviour is explicitly handled by the program.[7] [8]

Implementation

Primordial Soup is a virtual machine (VM) that runs Newspeak binary snapshopts of serialized Newspeak files. Internal Object Representation was inspired by the Dart VM and provides basic VM primitives for the language. It can be compiled by SCons on various platforms.

Example of code

" A declaration of a class Point"class Point x: i y: j = (" This section is the instance initializer"| "slots declarations are always between bars" public x ::= i. " ::= denotes slot initialization of a mutable slot" public y ::= j.|)("A method" public printString = (ˆ ’x = ’, x printString, ’ y = ’, y printString))

"Instantiation of the Point to the `p` slot inside some class"... public p := Point x: 42 y: 91....

"Hello World" example

"Hello, World!" program

HelloBraveNewWorld usingPlatform: platform = (platform Transcript open show: 'Hello, Oh Brave new world'.)

External links

Notes and References

  1. Web site: Bracha . Gilad . von der Ah´ . Peter . Bykov . Vassili . Kashai . Yaron . Maddox . William . Miranda . Eliot . June 2010 . Modules as Objects in Newspeak .
  2. http://bracha.org/newspeak.pdf Gilad Bracha, Peter Ahe, Vassil Bykov, Yaron Kashai and Eliot Miranda. The Newspeak Programming Platform.
  3. Web site: Room 101: We have Good news, and we have Bad news. Bracha. Gilad. Gilad Bracha. 2008-11-24. Room 101: A place to be (re)educated in Newspeak. Google Blogger. 2009-09-21.
  4. Gilad Bracha, Peter Ahe, Vassili Bykov, Yaron Kashai, William Maddox and Eliot Miranda. Modules as Objects in Newspeak. In the Proceedings of the 24th European Conference on Object Oriented Programming, Maribor, Slovenia, June 21–25, 2010.
  5. Web site: Bracha . Gilad . Von der Ah . Peter . Bykov . Vassili . Kashai . Yaron . Maddox . William . Miranda . Eliot . May 6, 2008 . The Newspeak Programming Platform . Cadence Design Systems . Researchgate.
  6. http://www.se-radio.net/2009/07/episode-140-newspeak-and-pluggable-types-with-gilad-bracha/ Software Engineering Radio Episode 140: Newspeak and Pluggable Types With Gilad Bracha/
  7. Currie . I.F. . July 1986 . NewSpeak: an unexceptional language . Software Engineering Journal . 0268-6961 . 1 . 4 . 170–176 . 10.1049/sej.1986.0027.
  8. Book: Cullyer, W.J. . Birtwistle . Graham . Subrahmanyam . P. A. . 2012-12-06 . https://books.google.com/books?id=XdjvBwAAQBAJ&q=rsre+newspeak+1984&pg=PA16 . VLSI Specification, Verification and Synthesis . Implementing Safety Critical Systems: The VIPER Micropocessor . 16–17 . Springer Publishing . 978-1461320074.