Agora general information
Wolfgang De Meuter
Last revision: November 17th, 1997
Agora general information
Agora is a prototype-based (also often referred to as an object-based)
language, which means that it has no classes. Instead, objects are created
by 'just writing them down', by extending existing objects or by copying
existing object (often called cloning). In Agora, everything is an object
and the only thing one is allowed to do with an object is to send it a
Agora features two kinds of messages: ordinary messages like in Smalltalk
and so called reifier messages. Reifier messages are consistently
written boldfaced. Reifier messages are comparable to special forms in
Scheme. Special forms like (if cond exp1 exp2) can be seen as
'special functions' whose arguments are not evaluated when the function is
applied. It is the implementation of the if special form that
will explicitely evaluate the arguments when needed. In Scheme there is no
syntactical provision for special forms. Hence, when encountering a
function application (f ...), the evaluator first checks whether
f is a special form. If so, it invokes the special form. If not,
the ordinary semantics for function application is used.
Reifier messages are like special forms. For example, an if-test
in Agora is written as cond ifTrue:exp1
ifFalse:exp2. Unlike Scheme, Agora employs a special
syntactical rule for it's 'special forms': all reifier messages are to be
denoted boldfaced. When a message is not in bold, it is treated as an
ordinary message. Otherwise, the message is sent to the unevaluated
receiver (a syntax object) with the unevaluated expressions as
Just like the particular flavour of Scheme is determined by the set of
special forms it defines, the entire language design of Agora lies in the
implemented reifiers. For example,Agora94
, Agora96 and
implement different reifier messages.
Encapsulation and Message Passing
The only operation on objects is message passing. This is in sharp
contrast to other prototype-based languages whose semantics requires delegation.
Since Agora is solely based on message passing, it is a language with a
very high degree of encapsulation. Nevertheless, Agora shows that even
within such a restricted setup, features like inheritance, cloning and
reflection are perfectly possible.
In Agora, inheritance is accomplished by mixin-methods.
A mixin-method is like an ordinary method, but when it is invoked, the
receiver of the message extends itself with the contents of the
mixin-method. This can result in a functional extension of the receiver (a
view) or a destructive extension of the receiving object.
Cloning an object is done by a cloning method. A cloning
method is a method like any other method. But when it is invoked, the
receiving object first copies its internal structures and then runs the
cloning method in the context of the copy. We think that cloning methods
can provide a solution for the prototype-corruption problem most
prototype-based languages suffer from.
Agora is a reflective
language, which means that is possible to access the implementation of
Agora from within the Agora language. Hence, the design of the
implementation is very important as it is part of the definition of Agora.
The most simple application of reflection in Agora is to write new reifier
methods. This is like being able to add new special forms to Scheme.
However, Agora goes further. Agora is a so called open
implementation which means that the entire implementation is
accessible and changeable from within Agora.