Contents | < Browse | Browse >

                           Amiga E: An Overview
  Jason Hulance                                  

  o  Price: £26 (Shareware)
  o  Author: Wouter van Oortmerssen
  o  Current Version: 3.2e

Amiga users are spoilt for choice when it comes to programming languages. 
There are several different dialects of BASIC, especially suitable for
beginners, and Assembly for the speed freaks.  In between lie languages
like C and Pascal.  You can even try your hand at functional languages such
as Lisp and Gofer.

Any new language has to offer something special to stand out from this
crowd.  So what does Amiga E have that makes it interesting?  Well, the
author, Wouter van Oortmerssen, designed E to be a good, general-purpose
language, since he was dissatisfied by the features and performance of C
compilers.  The result was a high-level, procedural language (with some
functional aspects) and an extremely fast compiler.

The first public release of E was v2.1a at the end of 1992.  The past three
years have seen it mature into a complete package of compiler, debugger and
hundreds of example programs.  Some well-known, quality programs have been
created using E, of which two examples are the superb graphics program
Photogenics (by Paul Nolan and Almathera) and the icon editor Iconian (by
Chad Randall).  So whay should you investigate E?

The speed is the first thing that strikes you when you try out the E
compiler.  Even the longest programs compile in the blink of an eye on a
standard, floppy-based A500, which is quite astonishing if you're used to a
C compiler.  This means that you can spend more time actually writing your
programs, and you can experiment without your enthusiasm being sapped by
the compiler.

What's more remarkable is that speed of compilation is not a trade-off
against the speed of compiled programs, and neither is it due to a cryptic

E code looks very much like Pascal or Modula-2 code.  However, E is based
more closely on C, and an E program will run as fast, if not faster, than a
similar C program.  In fact, E programs can even make use of true inline
Assembly, so they need never be slow.

E is no slouch, but this is by no means the end of the story.  The E
language has a number of very useful features, some of which are based on
the better features of other languages.

The idea of exceptions is borrowed from Ada, and they are used to simplify
and separate the code which deals with the various error cases of a
procedure or a number of procedures.  This, as with many of the other
features of E, can greatly increase the readability of a program by making
the real code much more concise and uncluttered.

Automatic exceptions simplify things further by allowing calls to library
functions to automatically raise exceptions if they result in certain
values (a null pointer, for example).  For example, you can protect every
call to AllocMem() with just one declaration, and then you can then use it
without having to check the result.  All your program needs to do is handle
the corresponding exception.

Object Oriented Programming is supported by Amiga E, even though E is in
essence a typeless language.  For the uninitiated, OOP is a set of
techniques which are meant to allow for faster development and easier
maintenance of large programs.  You do not need to use a language which
supports OOP in order to use the techniques, but it's a lot easier if you

Objects, methods, inheritance and data-hiding are the buzz-words of OOP.
All these concepts have been seamlessly introduced in version 3 of Amiga E,
with none of the kludges found in some other OOP languages.

The original designers of the Amiga realised that OOP was an important
concept, even before OOP languages were popular.  Many of the core parts of
the Operating System exhibit OOP features.  For example, the data structure
for a process includes (i.e., inherits) the structure of a task, and
processes can be used with functions which operate on tasks.

Since OS 2.0, many of the Amiga system functions make use of tag lists.  In
most other languages these correspond to arrays, and the problem with
arrays is that they have to be initialised before they can be used.  This
means that the contents of a tag list are necessarily separated from the
function call which uses it.  In E, a tag list is just a normal list
expression, so the contents of the list can be written in the same place as
the function call.

E also has strings (and lists) which can be safely manipulated without
worrying about exceeded their maximum sizes.  These data structures are at
least as efficient as normal strings in C and can be used wherever normal
strings might be used.  This means that there is one less problem for the E
programmer to worry about.

Cons cells
Lisp programmers know all about the power of cons cells and the usefulness
of a garbage collector.  By adopting these features, E allows a certain
degree of functional programming.

As well as being very readable, programs written in a functional language
can more easily be shown to be correct.  In fact, many mathematical
definitions require very little effort to translate them to a functional

Cons cells are very powerful objects which can be used to build almost any
data structure, although they are most commonly used to build linked lists.

A garbage collector is a mechanism for efficiently recycling any cons cells
that are no longer in use.  This means that programmers do not need to
concern themselves with the complex task of managing memory (at least not
for cons cells).

Another Lisp feature that has been adopted is quoted expressions, which
enables expressions to be passed around like values.  The benefit of this
is that the expression can be evaluated (using the Eval() function) at any
time and any number of times.  The resulting value depends on the values of
variables at the time of evaluation, not when the expression was quoted.

Quoted expressions make it possible to have functions like MapList() which
apply the same expression to each element of a list, creating a new list of
the same length.  This makes it easy to, for example, square the contents
of a list.

Borrowed from functional languages like Miranda and Gofer, unification (or
pattern matching) can be used with lists or cons cells in E.

Unification assigns values to variables based on matching some template
pattern.  A similar effect would commonly be achieved in other languages by
using a nesting of conditional statements.  The nesting gets quite deep
(and unreadable) if you want to do a complicated match, but with
unification all matches are linear, concise and easy to understand.  The
unification method can also be much more efficient.

Programs like language interpreters or compilers are full of the kinds of
tests that would benefit greatly from pattern matching.  So is dynamic
typing, where structures have tags to identify the type (or types) of the
rest of the structure.  In C you would probably use unions and a lot of
switch statements, but in E you could do the same thing more clearly and
efficiently using lists and unification.

Built-in functions
There are a lot of useful functions which are part of the E language. 
These serve to simplify many of the standard Amiga system functions (e.g.,
gadget creation) and to provide support functions like those in other
languages (e.g., improved memory management).

The E compiler also incorporates all the function calls from the four main
Amiga system libraries (Dos, Exec, Graphics and Intuition).  These
libraries are opened and closed automatically by every E program, so the
majority of small programs do not need to explicitly open (or close) any

Included with the Amiga E distribution is, amongst other things, a text
editor (with many E-specific features) and a very nice, source-level
debugger.  Of course, there is a Reference Manual, written by Wouter, which
is aimed at the more experienced programmer.  This is complemented by a
rather extensive tutorial for beginners, but I shouldn't comment further
because I wrote it!

A lot of people have written modules of useful functions for use in your
own E programs.  Two of the best are Async and EasyGUI.  Async provides a
set of replacements for the normal input functions.  The new functions use
an asynchronous buffering technique to speed up reading from a file or

EasyGUI, written by Wouter, provides an extremely simple way of creating
font sensitive and resizable GUIs.  Lists are used to specify the GUI, with
tags like SLIDER to specify a slider.  The layout is specified in very
loose terms.  For example, the tag EQROWS indicates that a collection of
parts of the GUI should be laid out in equally sized rows.  The actual
positions and sizes of each gadget (and group of gadgets) are automatically
determined, even after a resize.  And, although it is not as powerful as
MUI, the module is very small and very fast.

Also worthy of mention is the module FilledVector, which provides a
relatively simple interface to 3D filled vector rendering, using the
blitter.  Several of the example programs render quite complex objects as
animated Workbench backdrops!  Imagine a spinning and moving A1200 logo on
your Workbench, using up hardly any CPU.

The demo distribution of Amiga E is available from Aminet (in the dev/e
directory) or any good PD house.  It is also available from me, as the UK
registration site (Wouter lives in Holland).

The demo version is the same as the full distribution, except that the demo
compiler is restricted to creating small executables.  This means you can
try out the examples and learn the language using the Reference Manual or
the Beginner's Guide before you decide whether E is for you.

At current exchange rates, the registration fee is £26, on disk, or £23 via
E-mail.  Demo versions and compiler updates are free via E-mail, or cost £3
on disk.  Contact:

Jason Hulance (Dept E)
Formal Systems
3 Alfred Street
Oxford   OX1 4EH

Or E-mail:

The Reference Manual and Beginner's Guide cover most of the questions that
might arise, but where they are not sufficient advice can be sought at the
above addresses.  If you have access to E-mail you can also join the Amiga
E Mailing List, to which Wouter regularly contributes.  Just send a message