Introducing ScriptX

By Ray Valdés

Dr. Dobb's Journal
Software Tools for the Professional Programmer
Volume 19, Issue 13, November 1994

ScriptX is a multimedia-oriented development environment created over the last two years by Kaleida Labs. Unlike packages such as Macromedia Director, ScriptX is not an authoring tool for creating multimedia titles, although it does come with a built-in authoring tool. Rather, it is a general-purpose, object-oriented, multiplatform development environment that includes a powerful, dynamic language and a well-rounded class library. ScriptX is as applicable for implementing client/server applications as it is for authoring multimedia titles. While large, complex, and powerful, ScriptX is designed from the ground up in an integrated fashion, making it smaller, more consistent, and easier to learn than equivalent traditional systems (say, a C++ environment and class library).

With ScriptX's dynamic nature, classes, objects, and their relationships can be reconfigured during execution. Methods can be redefined and new objects added at run time. ScriptX code is semi-compiled into a bytecode representation, similar to that in Smalltalk, that is then interpreted by a platform-specific virtual-machine interpreter. Multithreading constructs are built into the language, which blends elements of Smalltalk, Dylan, Hypertalk, Lisp, Object Logo, C++, and Pascal.

Syntactically speaking, the language is small, about half the size of C and a fraction of C++ (in terms of BNF rules required to specify the grammar). There are no statements in ScriptX; every construct is an expression that returns a value. There are the usual block, iteration, and conditional constructs: If, Then, Else, While, and so on. There are also various ways of setting variable scopes: the local and global keywords for individual variables, and the module keyword which is a larger-granularity, scope construct roughly equivalent to the recently added namespace keyword in C++.

Everything in ScriptX is an object, including integers, strings, methods, classes, and functions. Integer and float objects have an "immediate" implementation that allows the bytecode interpreter to obtain values without method dispatching (by using tag bits and a bitshift, as is done in many Smalltalk implementations). There is no distinction at the level of bytecode representation between user-defined objects and classes and those supplied by the system; every entity has equivalent first-class status. In addition to supporting multiple inheritance, ScriptX lets you specialize behavior not just with classes, but also at the level of particular objects and individual methods. The ScriptX Core Classes comprise a class library that provides integrated general-purpose facilities like those in app frameworks such as OWL, MFC, zApp, MacApp, and C++/Views. The ScriptX library consists of about 240 classes and perhaps 2000 methods and provides support for text, fonts, streams, events, menus, scrolling lists, push buttons, scroll bars, files, properties, error-handling, arrays, B-trees, and more.

The most important aspect of the ScriptX classes is the use of classic Model-View-Controller (MVC) paradigm which, by decoupling an application's dataset from its presentation, enables the user to simultaneously view and manipulate an app's data in different ways (graphically, textually, and so on).

A key ScriptX feature is a Clock class, which provides facilities for synchronizing timed sequences of actions required by multimedia apps. Other classes implement a persistent-object storage facility, a search engine to retrieve objects within large-scale models, facilities for spawning and synchronizing multiple threads, a rich set of exception-handling mechanisms, and (in the future) support for distributing objects across networks.

For more information, send e-mail to kaleida.dev@kaleida.com.


Copyright 1994 by Miller Freeman, Inc. All rights reserved. Reprinted by permission.
For more information contact: Dr Dobbs Journal, 411 Borel Avenue Suite 100, San Mateo CA 94402, or email rayval@well.com.

`