COLA (software architecture)

COLA
Paradigm Multi-paradigm
Designed by
  • Ian Piumarta
Developer Ian Piumarta
First appeared 2009
dynamic, strong, safe, nominative
OS Cross-platform (multi-platform)
Website http://www.vpri.org/

COLA stands for Combined Object Lambda Architecture, and is a system for experimenting with software design currently being investigated by the Viewpoints Research Institute.[1] A COLA is a self-describing language in two parts, an object system which is implemented in terms of objects, and a functional language to describe the computation to perform.[2]

Since a COLA is written in itself, the whole environment (when bootstrapped) can be rewritten and extended by programming with the COLA; in other words, it does not require more knowledge to rewrite a COLA than it does to write a program to run in it (as opposed to running Python code in CPython for example, which requires knowledge of C in order to reprogram the language).

This flexibility has led to the work-in-progress COLA called 'idst'[3] becoming the implementation vehicle of choice for the Viewpoints Research Institute's research into 'reinventing programming', since it allows rapid creation and modification of new programming languages for study.[4]

Description

A COLA is designed to be the simplest possible language which can be described in itself, so that the implementation exactly describes itself. In order to do this the structure of the environment is separated from the semantics of the computation performed.

The object system describes the structure of a prototype-based Object Oriented environment.[5] This is implemented in terms of objects and message passing, which is in fact the same system it is describing. This allows modification of the system by using the same object oriented knowledge used to write any other application.

This object system is turned into a useful programming language by complementing it with a functional language describing what each object's methods do. The methods called from the object language are closures running a functional programming language.

Combined together, these two parts form a complete prototype-based Object Oriented programming language which is entirely self-hosting.

Natural Language Analogy

In order to illustrate the concept we can consider an analogy in natural language, say English. To define the whole of English for someone who speaks a foreign language would be a monumental task, especially since it would have to be done over and over again for each foreign language we're coming from. However, we could instead define a simpler subset of English as a base which is just expressive enough to understand definitions given in English. For example, such a subset would not need a word for "giraffe", since it could be added later with a statement like "A giraffe is a herbivore with a long neck." Similarly the definitions of herbivore, neck and long can be added later with other statements, and so on. This way we can remove every part of English which we do not need in our subset.

The bits we keep are those which are needed to understand definitions and statements (so that we can expand the language later), along with everything needed to define those, and so on. What we end up with is a self-contained language, written in itself (a subset of English) and capable of being expanded with statements like the giraffe one above.

Any English speaker is thus capable of changing the language itself as easily as they speak (since it's defined in English) by rewriting, overriding or bypassing the statements given in the base, turning the language into anything (including existing ones).

Also, anyone can become an English speaker simply by having this base translated into their native tongue (a more tractable problem than translating the whole of English). Once they know this subset then they know enough English to understand other statements like the giraffe one, and thus grow their knowledge to the whole language through English sentences (which can be reused by everyone, regardless of their first language). This is analogous to the bootstrapping and compatibility of a COLA.

The way a COLA such as idst implements this can be thought of as defining words using other words (the object system) separately to defining the grammar (the functional language).

Features

A COLA can be used in two ways:

Due to their flexible and extensibility it is possible to make COLAs compatible with many ABIs, which allows integration into existing libraries (for example, those written in C) whilst maintaining the ability to mutate the COLA into another (perhaps custom) language.

A completely COLA-based computer system, whilst capable of implementing the operating system, libraries, applications and other levels of a traditional computer system, allows these distinctions to blur or disappear if the end-user wishes. Every aspect of the computer system, since it is written in a COLA (including the COLA itself), can be overridden, mutated, bypassed, etc. just as the local datastructures and functions in a traditional program can. There is also flexibility in how code is run, since there is a choice of interpreting, static compilation, dynamic compilation, in fact if the COLA is given a suitable backend object then it can even reprogram FPGA's to run arbitrary sections of the system.

Current Implementation

Idst

Ian Piumarta's 'idst' system (the name is currently in flux) is a work-in-progress implementation of a COLA.[6] It consists of several components, such as the Id object model,[7] the Jolt function language [8] and the Pepsi object oriented language. Pepsi was bootstrapped by writing two Pepsi compilers, one in C++ and one in Pepsi, then compiling the latter with the former, then in with itself. This made Pepsi self-hosting, and the C++ version was discarded.[9]

Projects

The idst COLA has already been used in the following projects:

OMeta - An object oriented pattern matching language based on Parsing Expression Grammars

JOHN - A goal-oriented programming language

JITBLT - An image compositing engine

References