Vanilla: Towards more Modular Programming Languages
by Simon Dobson
The emergence of the Internet as a commercial force is now well
under way. A particularly powerful business model is the notion
of a virtual enterprise, a temporary alliance of companies brought
together to exploit some transient market opportunity. Such systems
typify a class of applications in which a set of components must
be composed in a highly dynamic manner. As well as the obvious
correctness issues, it is clear that notions such as webs of trust,
role-based interactions and on-the-fly adaptability are neither
properly understood nor well supported by current programming
language technologies.
Trinity College Dublin has a long-term interest in very large-scale
distributed systems. We felt that there was a need to experiment
rapidly with novel language constructs for component composition,
object re-use models and non-standard type checking. We were also
concerned by the change in programmer demographics away from dedicated
programmers happy with mainstream languages and towards domain
specialists needing targeted, high-level scripting languages in
which to write their own applications. Traditionally, programming
language research has had an unacceptably high barrier to entry.
A tool such as compiler or interpreter is a large, complex software
system, which is difficult to understand and modify. This makes
it difficult to experiment with minor changes to full languages,
or to create bespoke domain-specific languages.
The Vanilla project applies component-based program composition
to the construction of the language tools themselves. Vanilla
allows the language designer to construct a language by combining
a number of components (or pods), each of which captures the
syntax, type-checking and behaviour of a single language feature.
A typical pod might define a feature such as the integers with
a particular concrete syntax for the numbers and operators, a
parser to the corresponding abstract syntax, a type checking component
to ensure the type-correctness of programs and an interpreter
component to evaluate the expressions. The individual components
may be changed independently, for example allowing a new concrete
syntax to be defined while re-using the existing types and behaviours.
New features may be defined in isolation before being combined
with other features to create the final language. This incremental,
experimental approach greatly reduces both complexity and development
times.
A common design pattern used within Vanilla (shown in the figure)
allows components to express an interest in one or more abstract
syntax tree node types. On encountering such a node the system
walks the chain of interested components, allowing each in turn
to either deal with the node, determine an error condition, or
pass the node to the next component in the chain.
We have constructed a number of standard pods covering a large
portion of the language design space - including procedural, functional,
object-oriented and typeful language features. It turns out
that many features are orthogonal to each other, so (for example)
it is possible to define object types without committing to exactly
what types may compose the members. This makes for some interesting
generalisations to well-known concepts.
Of particular interest are the pods handling network interactions,
for example with CORBA objects. We use a component-based mapping
between Vanilla and CORBA IDL, which allows applications to access
objects on the Internet with the absolute minimum of additional
code. Moreover, by completely separating the protocol handlers
from the rest of the application, we allow the same code to be
used simultaneously via a number of different protocols (CORBA,
DCOM, event-based models etc). This radically simplifies the construction
of applications in highly heterogeneous environments.
We are currently using Vanilla to explore four complementary language
areas: mobile objects and agents, novel object composition patterns,
dynamic construction of applications based around XML document,
and scripting languages for describing interactions with intelligent
buildings. More information on the Vanilla project at http://www.cs.tcd.ie/Virtues/Vanilla/
Please contact:
Simon Dobson - CLRC and Trinity College Dublin
Tel: +353 1 608 2224
E-mail: simon.dobson@cs.tcd.ie