The Mjølner System: BETA Language
BETA is developed within the Scandinavian School of object-
orientation, where the first object-oriented language, Simula, was
developed. BETA is a modern language in the Simula tradition. The
resulting language is smaller than Simula in spite of being
considerably more expressive. BETA is a strongly typed language
like Simula, Eiffel and C++, with most type checking being carried
out at compile-time. It is well known that it is not possible to
obtain all type checking at compile time without sacrificing the
expressiveness of the language. BETA has optimum balance between
compile-time type checking and run-time type checking.
Powerful Abstraction Mechanisms
BETA has powerful abstraction mechanisms that provides excellent
support for design and implementation, including data definition
for persistent data. The powerful abstraction mechanisms greatly
enhances reusability of designs and implementations.
The abstraction mechanisms include: class, procedure, function,
coroutine, process, exception, and many more, all unified to the
ultimate abstraction mechanism: the pattern. In addition to the
pattern, BETA has subpattern, virtual pattern and pattern
variable.
This unification of abstraction mechanisms gives a uniform
treatment of abstraction mechanisms and a number of new
abstraction mechanisms. Most object-oriented languages have
classes, subclasses and virtual procedures and some have procedure
variables. Since a pattern is a generalization of abstraction
mechanisms like class, procedure, function, etc., the notions of
subpattern, virtual pattern and pattern variable also apply to
these abstraction mechanisms. The following table shows some of
the possible combinations supported by BETA:
|
class |
procedure |
generic class |
process |
exception |
pattern |
|
|
|
|
|
subpattern |
|
|
|
|
|
virtual pattern |
|
|
|
|
|
pattern variable |
|
|
|
|
|
nested pattern |
|
|
|
|
|
- Pattern:
-
The pattern is the ultimate abstraction mechanism that
generalizes class, procedure, function, coroutine, process,
exception, etc.
- Subpattern:
-
The subpattern covers subclasses as in most other
languages. In addition, procedures may be organized in a
subprocedure hierarchy in the same way as classes may be organized
in a subclass hierarchy. Since patterns may also be used to
describe functions, coroutines, concurrent processes, and
exceptions, these may also be organized in a pattern hierarchy.
- Virtual pattern:
-
The notion of virtual pattern covers virtual
procedures like in Simula, Eiffel and C++. In addition, virtual
patterns cover virtual classes, virtual coroutines, virtual
concurrent processes, and virtual exceptions. Virtual classes
provide a more general alternative to generic classes as in Eiffel
or templates as in C++.
- Nested pattern:
-
BETA is a block structured language. This means that patterns can be
textually nested. Nested procedures are known from Algol and Pascal.
In addition to nested procedure patterns, BETA also supports nesting
of class patterns. Nested class patterns makes it possible to define
a class pattern as an attribute of an object. Often the structure
of an object is defined by other classes. Nested makes it possible
to define such classes where they logically belong.
- Pattern variable:
-
BETA includes the notion of pattern variable.
This implies that patterns are first class values, that may be
passed around as parameters to other patterns. By using pattern
variables instead of virtual patterns, it is possible dynamically
to change the behavior of an object after its generation. Pattern
variables cover procedure variables (i.e. a variable that may be
assigned different procedures). Since pattern may be used as
classes, it is also possible to have variables that may be
assigned different classes, etc.
Coroutines and Concurrent Processes
BETA does not only allow for passive objects as in Smalltalk, C++
and Eiffel. BETA objects may also act as coroutines, making it
possible to model alternating sequential processes and quasi-
parallel processes.
BETA coroutines may be executed concurrent (non pre-emptive
scheduling in current version). The basic mechanism for
synchronization is semaphores, but high-level abstractions for
synchronization and communication, hiding all details about
semaphores, are easy to implement, and the standard library
includes monitors and Ada-like rendezvous. The user may easily
define new concurrency abstractions including schedulers for
processes.
The distribution library supports true concurrency between BETA
objects. The current implementation only supports non-preemptive
scheduling within a process. Preemptive scheduling and multi-processor
support is currently being implemented.
Support for subfunctions of abstraction
BETA supports the three main subfunctions of abstraction:
- Identification
of Objects
-
It is possible to describe objects that are not
generated as instances of a class pattern, so-
called "class-less objects". This is in the many
cases useful when there is only one object of a
kind. In most object-oriented languages, it is
necessary to define superfluous classes for such
objects. In analysis and design, it is absolutely
necessary to be able to describe singular objects
without having to define them as instances of
classes.
- Classification
-
Classification is supported by patterns,
subpatterns and virtual patterns that makes it
possible to describe a classification hierarchy of
objects and patterns (i.e. objects, classes,
procedures, functions, coroutines, processes,
exceptions, etc.).
- Composition
(Aggregation)
-
Objects and patterns may be defined as a
composition of other objects and patterns. The
support for composition includes:
- Whole/part
composition
-
An attribute of an object may be a part object.
This makes it possible to describe objects in
terms of their physical parts.
- Reference
composition
-
An attribute of an object may be a reference to
another object. Reference composition forms the
basis for modeling arbitrary relations between
objects.
- Localization
-
In the form of block-structure: An attribute of an
object may be a (nested) pattern. The block-
structure mechanism makes it possible to create
arbitrary nested patterns. This makes it possible
for objects to have local patterns used as
classes, procedures, etc. Local patterns greatly
enhances the modeling capabilities of an object-
oriented language.
Inheritance
In BETA, inheritance is not only restricted to inheritance from
superpatterns. It is also possible to inherit from a part object.
Virtual patterns in the part object may be redefined to influence
the enclosing object. Multiple inheritance is supported through
inheritance from multiple part objects. This gives a much cleaner
structure than inheritance from multiple superpatterns.
Downloads
Download The Mjølner System
Download the book Object-oriented Programming in the BETA
Programming Language(PDF)
BETA Programming Language related downloads
More Information
For further information see:
Books:
Object-Oriented
Programming in the BETA Programming Language
Newsgroups:
comp.lang.beta
comp.lang.beta news archive
comp.object
Other information:
MIA 94-26: BETA Language Introduction - Tutorial
MIA 99-41: BETA Language Modifications - Reference Manual
MIA 90-02: BETA Compiler -
Reference Manual
MIA 99-42: The Fragment System: Further Specification
BETA Terminology
BETA Quick Reference Card