Main Page | See live article | Alphabetical index

NewtonScript programming language

NewtonScript is an prototype based programming language created to write programs for the Apple Newton. It is heavily influenced by the Self computer language, but extended to be more suited to the personal digital assistant's needs.


Traditional computers, at least in the desktop role, have two modes; "on" and "off". When moving from one mode to the other the state of the machine is lost from memory, and requires a sometimes lengthy "boot" process to return the machine to the "on" state. This does not suffice for a PDA type device where the user expects the machine to be available almost instantly for taking down quick notes. Yet a machine can not be left "on" for any length of time either, as this would drain the battery too much to make it useful for carrying around.

In the Newton the system had two states that were more like "on" and "sleeping". When moving to the sleeping state the memory was not lost and instead the system simply stopped working on the contents of memory, which allowed for many of the chips inside to be turned off. This greatly extended battery life, yet still allowed the machine to turn back on almost instantly.

With the main memory always being kept alive, the system becomes much more amenable to use as a persistent object store. Many object-oriented systems, like Smalltalk, are based on a continually running memory image (known as a snapshot), so using the Newton with an object-oriented system seemed quite natural.

The developers then began looking for languages to use on the system. The Newton was originially going to be programmed in the new Dylan programming language, but a lengthy series of delays combined with NIH eventually led to it being abandoned. The team had looked at Self and were very interested in it, but at the time Self was not yet ready for real-world use.

The result was a modified version of Self known as NewtonScript. Written primarily by Walter Smith, the language was a part of the Newton Toolkit, introduced along with the Newton on August 1993.

NewtonScript vs. Self

Changes were primarily aimed at three "problems" in Self.

One is that the typical Self snapshot requires 32MB of RAM to run in, whereas the Newton had only 128kB internally to use for the 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'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 the Newton programs to be developed on a Macintosh running the Toolkit, where the programs would be compiled and then downloaded to the Newton for running.

However this also led to what is generally considered the most serious flaw of the system. Since the 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 a hex code, without any ability to match it to lines in the original code.

External link