display | more...

NewtonScript is a prototype-based programming language similar to Self. It was designed by Walter Smith specifically for Apple's Newton MessagePad. Despite running on a platform with only 128K of RAM, NewtonScript supports many modern language features such as exceptions and garbage collection.

The concept of object is a bit different in NewtonScript than in other languages, such as smalltalk. Everything in NewtonScript is technically an object, but only objects of type "frame" have properties (slots), receive messages, and inherit from other frames.

As a prototype-based language, NewtonScript inheritance also differs from classical object-oriented inheritance. Every frame has a "prototype," which is referenced in the "_proto" slot (slots in NewtonScript are analogous to instance variables in other languages). If you attempt to access a slot that does not exist, the frame will delegate to its prototype.

Frames may also have a "parent," referenced in the "_parent" slot. This second way of inheritance is designed to facilitate hierarchies of user interface elements; a button might have its _parent set to a toolbar, which would then have a _parent of the main view.

NewtonScript's prototype-based nature lends itself very well to GUI programming. In an object-oriented language, making objects like buttons with different behaviors is a tedious ordeal. Either every kind of UI widget needs a different class, or each widget ends up delegating to a huge controller object, existing solely to perform UI actions. NewtonScript avoids this problem by removing classes altogether; just set the ButtonClickScript of your button to whatever function you need, or change the viewBounds slot to the new dimensions of your widget.

This language died with the Newton OS, and nobody except crazy wackos like me writes anything in it anymore. If you're still interested, go get yourself a MessagePad from ebay and download the NewtonDev archive from UNNA (http://www.unna.org/view.php?/development/NewtonDev). This archive includes a development environment for the Macintosh along with a bunch of excellent documentation.

Log in or register to write something here or to contact authors.