By Ray Valdes
In a year when multimedia companies have each enjoyed their 15 minutes of
fame, one of Silicon Valley's more intriguing companies -- Kaleida Labs
-- has remained in the background. Kaleida, a blue-chip startup born with
a silver spoon in its mouth, was founded with great expectations on the
part of its uppercrust corporate parents, Apple and IBM. After its unveiling
a year ago at the Digital Media show, the company shed 25 percent of its
workforce this spring as part of a new, pragmatic emphasis on completing
the multimedia development environment and scripting language known as "ScriptX,"
while relegating grandiose plans, such as the set-top hardware and operating
system, back to the parent companies.
Dr. Dobb's Developer Update:
Trends and Technologies for the Professional Programmer
Volume 1, Number 7, September 1994
Currently, ScriptX is in beta (on Macintosh and Windows platforms) and is
due for a fall shipment. This article is a quick look at the current system
and should be read with the usual skepticism required for any beta software.
It is always interesting to examine the results of what deep pockets and
a clean slate can provide. In the case of startups like Kaleida, with the
resources to round up a critical mass of talented programmers/designers
and persuade them to work in hothouse secrecy for several years, the result
is a veritable feast (or at least a well-stocked dessert tray) of new software
technologies. In this respect, Kaleida resembles other technology-intensive
startups -- General Magic, Next, Go Corporation, 3DO, and Rocket Science
all come to mind. Kaleida's efforts provide a glimpse of where multimedia
may be headed. Whether or not the company prevails, it's likely that its
juiciest designs will be imitated and incorporated into the mainstream.
Unlike packages such as MacroMind Director or Asymetrix Toolbox, ScriptX
is not an authoring tool for multimedia titles. Rather it is a general-purpose,
object-oriented, multiplatform development environment which includes a
powerful dynamic language and a well-rounded class library. You can use
the ScriptX system to implement client/server applications just as easily
as creating a multimedia shoot-'em-up game -- in fact, given the system's
current resource requirements, perhaps more easily. You can also use ScriptX
as a toolkit to create your own authoring tools. The package includes the
Kaleida Authoring Player, an authoring tool that fills the same need as
Director or similar tools. The system design is flexible enough that you
are not restricted to a particular authoring metaphor: You can use a stack/card,
timeline-based, score/cast, or document-oriented metaphor. Or you can mix
To get the equivalent expressive power in a conventional development environment,
you'd need to have, say, the Borland or Microsoft C/C++ compiler -- plus
the OWL or MFC application frameworks, plus a library of multimedia routines
(such as Lenel's Multimedia Works), a persistent-object storage system (such
as Object Design's ObjectStore), and some system extensions that provide
multithreading. The documentation for such a combination would total more
than 12,000 pages. ScriptX's integrated design results in a much smaller
learning surface: The documentation weighs in at about 2000 pages, yet is
Smalltalk or Lisp/CLOS programmers will immediately feel at home with ScriptX,
even though the syntax and libraries are significantly different. And if
you don't have Smalltalk experience, the system is dynamic enough that you
can start trying out stuff tight away. Not that Kaleida expects authors
of multimedia titles to be programmers. The manual states: "It is expected
that most ScriptX programs will be generated by authoring tools or development
environments specialized for multimedia title and tool development."
The ScriptX Language
The ScriptX language is a blend of concepts found in Smalltalk, Dylan, Hypertalk,
Lisp, Coral Object Logo, C++, and Pascal. Most of the borrowing seems intentional
and explicit, rather than haphazard or unconscious. The resulting blend
is a well-balanced, well-integrated mix that feels natural and consistent.
The language is small. You can specify ScriptX syntax in about 60 BNF rules,
compared with about 150 for C and perhaps double that for C++. The Kaleida
design decouples syntax from semantics, as does Apple's OSA, so that you
can have multiple syntactic surfaces overlaying a common semantic structure.
In theory, this would allow you to write code using the English version
of ScriptX, then have a smart text editor prettyprint it in Japanese ScriptX
(or Basic or Lisp dialects).
As it is in Smalltalk, everything in ScriptX is an object -- including integers,
strings, methods, classes, and functions. Source code compiles into a machine
independent bytecode that is interpreted by a bytecode interpreter, similar
to the Virtual Machine interpreter in classic Smalltalk. There is therefore
no distinction, at this level of representation, between user-defined objects
and classes and those supplied by the system; every entity has equivalent
first-class status. The Virtual Machine approach facilitates cross-platform
portability. A title created with ScriptX consists of scripts in bytecode
form, plus media content (digital video and audio data), fed to the platform-specific
Kaleida Media Player (KMP).
There are no statements in ScriptX; every construct is an expression that
returns a value. So instead of block statements, you have block expressions.
Likewise with iteration and conditionals, which consist of the usual suspects
-- if, then, else, while, repeat, case, and so on. Variable scoping is lexical
in nature, and block expression can be used to generate new variable scopes.
As in Hypertalk, you can use the local and global keywords to explicitly
specify variable scope. There is also a larger-granularity way of setting
scope, via the module keyword, roughly equivalent to the recently added
namespace construct in C++.
Similar to Hypertalk, the ScriptX language allows for variant constructs
(syntactic sugar) that add an English-like feel to the language. For example,
instead of saying anObject.instanceVar (as you would in C++), you can use
the possessive form: anObject's instanceVar. A related mechanism allows
for operator overloading similar to that in C++. Also, ScriptX allows you
to specify the parameters to a method invocation by position or by keyword.
You may be pleased (or possibly dismayed) to note that ScriptX supports
multiple inheritance. ScriptX also allows you to specialize behavior not
just via classes, but also at the level of particular objects and individual
methods. You can call this a truly object-oriented approach, contrasted
with the class-oriented paradigm used by Smalltalk, C++, and most other
Going further, ScriptX combines the OO model with the applicative-language
paradigm by allowing free-standing functions -- behavior that is not bound
to a method of a particular class. This allows for anonymous functions (similar
to lambda functions in Lisp) that can then be applied to objects. The construct
"(a b -> a + b) 4 5" defines an anonymous function that is
applied to the objects 4 and 5. Anonymous functions can be assigned to variables,
passed as arguments, or used in the apply construct (as in Lisp).
As in Smalltalk, there is a metaclass hierarchy that parallels the class
hierarchy. Likewise, certain objects have an "immediate" implementation:
for example, instances of class ImmediateInteger are implemented as a 32-bit
longword with a low-order tag bit set. The kernel uses a right bit-shift
to obtain the immediate object's value. Multiple tag bits are used, resulting
in a maximum value of 2 to the 29th for ImmediateInteger. Instead of object-table
indexes, ScriptX object handles are basically 32-bit pointers into a paged
Memory allocation is automatic, as is deallocation. A garbage-collector
thread continually reclaims memory from objects that are no longer referenced.
The patent-applied-for garbage collector is an advance over those found
in current Smalltalk and Lisp implementations, which use variants of the
Baker-Hewitt generation-scavenging algorithm. The ScriptX garbage collector
needs to satisfy the real-time constraints of multimedia playback, which
does not tolerate sudden stops to collect garbage.
The kernel of ScriptX consists of objects written in compiled C. Like Go's
PenPoint, Kaleida has defined an object-oriented dialect of C called "Objects
in C" (OIC), implemented by a set of preprocessor macros, libraries,
and programming conventions. The membrane between objects written in C and
those in ScriptX is thoroughly permeable: Code written in one language can
access objects and instance variables written in the other.
The ScriptX Core Classes
From the point of view of a developer creating a multimedia title or commercial
app, the details of language syntax are often the least important aspect
of the development environment. The heavy lifting gets done by the class
library or application framework.
The ScriptX Core Class library consists of about 240 classes and perhaps
2000 methods. A significant part of the class library provides general-purpose
facilities such as you might find in app frameworks like OWL, MFC, zApp,
MacApp, and C++/Views. The Core Classes provide support for: text, fonts,
streams, graphics, events, menus, scrolling lists, push buttons, scrollbars,
files, properties, numerics, error-handling, arrays, B-trees, hash data
structures, and so on.
The most important aspect of the core classes is the use of the classic
Model/View/Controller (MVC) paradigm, first used in Smalltalk-80 and since
incorporated into many app frameworks with slight variations. ScriptX parlance
uses the terms model, presenter, and controller; in addition, "space"
is used to refer to a portion of the model. A space provides the virtual
environment in which content objects live and interact. Depending on the
application you are designing, a space can be geometrical in nature (a canvas
or surface) or non-geometrical (a stack of cards or a cast sheet of actors).
A controller manipulates objects in a space, often during some elapsed time
period. A presenter translates the abstract definition of content objects
into forms that users can see, hear, or otherwise experience.
Unlike many classic MVC-based apps, ScriptX titles make greater use of the
notion of time. The Clock class is an important component that provides
facilities for synchronizing timed action sequences and can be used to drive
simulations, control media playback, and coordinate activities within a
timing hierarchy (in which one clock drives subordinate clocks).
There are several other families of classes in ScriptX that provide powerful
facilities needed to implement a wide range of multimedia titles. These
class families include a persistent-object storage facility based on Apple's
Bento design (which is also used in the OpenDoc app framework), a search
engine to provide retrieval of 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. Each of these components merits its own discussion, but space
does not permit that here.
Designers at Kaleida feel that existing multimedia titles offer only "a
fixed universe of behaviors and portrayals." Existing tools can only
superficially simulate -- instead of "directly model" -- complex
behavior. Company documents state:
"Unlike today's metaphor-based authoring frameworks, ScriptX provides
simulation-based building blocks that let developers have real models behind
their scenes, instead of being essentially a movie with a few twists."
To illustrate this approach, designers at Kaleida implemented a sample title
called "PlayFarm." This title is a kid-oriented simulation of
a barnyard, with playful eccentric characters such as ducks and sheep. In
PlayFarm, each character runs in a separate thread, interacting with others
in virtual space. Unlike existing point-and-click commercial titles, the
behavior of the system is not predetermined and immutable, but dynamic and
easily changed. You can design a new character offline and then load your
creation into PlayFarm on the fly, while the simulation is running. Your
new character can then interact with the existing inhabitants of the virtual
ScriptX is an impressive piece of work. But it is not yet clear if it will
prevail in the marketplace. As with any beta, there exist the usual concerns
about robustness, efficiency, and on-schedule delivery. Plus, in the case
of a new platform, there is the issue of garnering sufficient industry support.
History shows that most blue-chip, technology-intensive startups seem to
stop short of success (witness the stories of Go and Next). However, with
its advanced, innovative, and well-designed technology, Kaleida just may
beat the odds.
Article contents 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 firstname.lastname@example.org.