NewtonScript
   HOME

TheInfoList



OR:

NewtonScript is a prototype-based
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
created to write programs for the
Newton Newton most commonly refers to: * Isaac Newton (1642–1726/1727), English scientist * Newton (unit), SI unit of force named after Isaac Newton Newton may also refer to: Arts and entertainment * ''Newton'' (film), a 2017 Indian film * Newton ( ...
platform. It is heavily influenced by the
Self The self is an individual as the object of that individual’s own reflective consciousness. Since the ''self'' is a reference by a subject to the same subject, this reference is necessarily subjective. The sense of having a self—or ''selfhood ...
programming language, but modified to be more suited to needs of
mobile Mobile may refer to: Places * Mobile, Alabama, a U.S. port city * Mobile County, Alabama * Mobile, Arizona, a small town near Phoenix, U.S. * Mobile, Newfoundland and Labrador Arts, entertainment, and media Music Groups and labels * Mobile ( ...
and
embedded devices An embedded system is a computer system—a combination of a computer processor, computer memory, and input/output peripheral devices—that has a dedicated function within a larger mechanical or electronic system. It is ''embedded'' as ...
.


History

On August 3, 1993, Apple unveiled the Apple Newton
MessagePad The MessagePad is a discontinued series of personal digital assistant devices developed by Apple Computer for the Newton platform in 1993. Some electronic engineering and the manufacture of Apple's MessagePad devices was undertaken in Japan ...
. The device had 640 KB RAM, 4 MB ROM, and an 20 MHz
ARM In human anatomy, the arm refers to the upper limb in common usage, although academically the term specifically means the upper arm between the glenohumeral joint (shoulder joint) and the elbow joint. The distal part of the upper limb between th ...
610 microprocessor. The main intention behind Newton project, was to develop a device capable of replacing a computer while being portable. With limited battery and memory, the developers were looking for programming language capable of meeting these challenges. The developers looked at the
C++ C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
programming language but realized that it lacked flexibility. They started focusing on prototype based languages and were impressed with Smalltalk and Self. Concurrently Apple was developing another dynamic programming language called Dylan, which was a strong candidate for the Newton platform. However, both Self and Dylan were dropped out of consideration, as they were both in nascent stage for proper integration. Instead, a team headed by Walter R Smith, developed a new language called as NewtonScript. it was influenced by
dynamic language In computer science, a dynamic programming language is a class of high-level programming languages, which at runtime execute many common programming behaviours that static programming languages perform during compilation. These behaviors cou ...
like
Smalltalk Smalltalk is an object-oriented, dynamically typed reflective programming language. It was designed and created in part for educational use, specifically for constructionist learning, at the Learning Research Group (LRG) of Xerox PARC by Alan Ka ...
and prototype model based like Self.


Features

Although NewtonScript was heavily influenced by Self, there were some differences in both the languages. Differences arose due to three perceived problems with Self. # One is that the typical Self snapshot requires 32 MB of
RAM Ram, ram, or RAM may refer to: Animals * A male sheep * Ram cichlid, a freshwater tropical fish People * Ram (given name) * Ram (surname) * Ram (director) (Ramsubramaniam), an Indian Tamil film director * RAM (musician) (born 1974), Dutch * ...
to run in, whereas the Newton platform was designed to use only 128 KB for the operating system. This required some serious paring down of the engine to make it fit and still have room for applications. # Another issue was performance. Since the language would be used for the entire system, as opposed to just running on an existing operating system, it needed to run as fast as possible. # Finally, the inheritance system in the normal Self engine had a single parent object, whereas
GUI The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, inste ...
s typically have two — one for the objects and another for the GUI layout that is typically handled via the addition of a slot in some sort of GUI-hierarchy object (like View). The syntax was also modified to allow a more text-based programming style, as opposed to Self's widespread use of a GUI environment for programming. This allowed Newton programs to be developed on a computer running the Toolkit, where the programs would be compiled and then downloaded to a Newton device for running. One of the advantages of NewtonScript's prototype based inheritance was reduced memory usage, a key consideration in the 128 KB Newton. The prototype of a GUI object could actually be stored in ROM, so there was no need to copy default data or functions into working memory. Unlike class-based languages, where creation of an object involves memory being allocated to all of its attributes, NewtonScripts' use of prototype inheritance allowed it to allocated memory to few fields like _proto and _parent instead of creating whole new object. Here, _proto and _parent signifies whether the object is using prototype or parent inheritance. An example to illustrate above concept, a developer might create a new button instance. If the button uses the default font, accessing its font "slot" (i.e., property or member variable) will return a value that is actually stored in ROM; the button instance in RAM does not have a value in its own font slot, so the prototype inheritance chain is followed until a value is found. If the developer then changes the button's font, setting its font slot to a new value will override the prototype; this override value is stored in RAM. NewtonScript's "
differential inheritance Differential inheritance is a common inheritance model used by prototype-based programming languages such as JavaScript, Io and NewtonScript. It operates on the principle that most objects are derived from other, more general objects, and only dif ...
" therefore made efficient use of the Newton's expensive
flash RAM Flash memory is an electronic non-volatile computer memory storage medium that can be electrically erased and reprogrammed. The two main types of flash memory, NOR flash and NAND flash, are named for the NOR and NAND logic gates. Both us ...
by storing the bulk of the default data and code in the PDA's cheaper and much larger
ROM Rom, or ROM may refer to: Biomechanics and medicine * Risk of mortality, a medical classification to estimate the likelihood of death for a patient * Rupture of membranes, a term used during pregnancy to describe a rupture of the amniotic sac * ...
.


Important terms

Views: They are objects created by Newton View System, which are created on run-time to render views. Template: It is a blueprint from which views are created. Protos: They can be blueprint for a template or a view, and are elements of NewtonScript code libraries. Frame and Slot: Frame is a dynamic collection of slots, and one element of frame is called as a slot. A slot is made up of name and value. The value can be of any type. It is worthwhile to note that all objects in NewtonScript are frames. Soup and Entry: It is a related collection of frames/ data. Entry is an individual frame in a soup. Frame Heap: RAM allocated dynamically by NewtonScript. Base View: It is the main view of application, consisting of all the variables and
methods Method ( grc, μέθοδος, methodos) literally means a pursuit of knowledge, investigation, mode of prosecuting such inquiry, or system. In recent centuries it more often means a prescribed process for completing a task. It may refer to: *Scien ...
used in the application.


Advantages and Disadvantages

;Advantages * NewtonScript is a dynamic prototype based programming language, which uses differential inheritance. This means that it is very effective in using memory space. Being dynamic, it is easy to modify objects, type checking, etc. at run time, giving great flexibility for developers. * Objects created can be stored in permanent memory like flash card or internal memory. The RAM is used only for storing attributes whose values change during runtime. This reduces memory consumption. * Writing interfaces for GUI applications can be implemented effectively using the prototype model, since we can directly write an object for a GUI control rather than creating a class and instantiating it. *
Garbage collection Waste collection is a part of the process of waste management. It is the transfer of solid waste from the point of use and disposal to the point of treatment or landfill. Waste collection also includes the curbside collection of recyclable m ...
is carried automatically by the system. This helped the developers to focus more on application development rather than worrying about memory management. Garbage collection also helped in mitigating problem of
dangling pointer Dangling pointers and wild pointers in computer programming are pointers that do not point to a valid object of the appropriate type. These are special cases of memory safety violations. More generally, dangling references and wild references are ...
s where a pointer erroneously points to a memory location that was deallocated. ;Disadvantages * Since NewtonScript code was written on one platform and run on another, it was practically impossible to debug. Better debugging code in the Newton engine would have helped offset this problem to some degree, but the limited memory made this difficult. Instead the developer would get a vague indication along with an error code, without any ability to match it to lines in the original code. * Another disadvantage is that, dynamic variable reduces the speed of operation since simple pointer dereference cannot be used as in statically typed like C++ and Java.


Influences

With the cancellation of the Newton project by Apple in 1998, all further mainstream developments on NewtonScript were stopped. However, the features used in NewtonScript would continue to inspire other programming models and languages. The prototype-based object model of Self and NewtonScript was used in
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
, the most popular and visible language to use the concept so far. NewtonScript is also one of the conceptual ancestors (together with Smalltalk, Self, Act1,
Lisp A lisp is a speech impairment in which a person misarticulates sibilants (, , , , , , , ). These misarticulations often result in unclear speech. Types * A frontal lisp occurs when the tongue is placed anterior to the target. Interdental lisping ...
and
Lua Lua or LUA may refer to: Science and technology * Lua (programming language) * Latvia University of Agriculture * Last universal ancestor, in evolution Ethnicity and language * Lua people, of Laos * Lawa people, of Thailand sometimes referred t ...
) of a general-purpose programming language called Io which implements the same differential inheritance model, which was used in NewtonScript to conserve memory.


See also

*
Prototype-based programming Prototype-based programming is a style of object-oriented programming in which behaviour reuse (known as inheritance) is performed via a process of reusing existing objects that serve as prototypes. This model can also be known as ''prototypal'' ...
*
Dynamic programming language In computer science, a dynamic programming language is a class of high-level programming languages, which at runtime execute many common programming behaviours that static programming languages perform during compilation. These behaviors cou ...
*
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...


References

{{Reflist


External links


SELF and the Origins of NewtonScript
by Walter Smith, 1994.
Using a Prototype-based Language for User Interface: The Newton Project’s Experience
(PDF), by Walter Smith, 1995.

by Walter Smith, 1993.
Additional Newton-related papers
by Walter Smith.
The NewtonScript Programming Language
(archive.org cache; original link dead as of 10/15/04.)
NEWT/0
A portable NewtonScript compiler/interpreter

a NewtonScript development environment that enables development to be carried out directly on the Newton by Steve Weyer.
DyneTK
a NewtonScript development environment that replaces the original Newton ToolKit (NTK); works on MS Windows and Mac OS X by Matthias Melcher. Apple Newton Prototype-based programming languages Dynamically typed programming languages Scripting languages