Several list subscribers were interested in the Beta programming language. That
Simula-like language is very powerful and you haven't a hope of learning it (well, _I_
couldn't anyway) without the definitive book, Object-Oriented Programming in the Beta
Programming Language by Ole Lehrmann Madsen et.al. THE BOOK IS OUT OF PRINT! You're
not out of luck --- I corresponded with the author and he has made the book available
in pdf form on his personal web pages while he negotiates with the publisher for new
edition or reprinting. I don't think he intended to make the pdf book _publicly_
available so please do NOT disseminate its url location, but for YOU it is available
at <http://www.daimi.au.dk/~olm/PUB/>. Get it now.
The "beta book" is 360 pages long and quite well written. (It is certainly logical;
the authors are from Aarhus University, the Norwegian Computing Center, and the
University of Oslo.)
BTW, the html documentation that comes with the Beta 5.0 release is quite extensive.
I printed all of it on double-sided paper and had it durably bound. My three-volume
set is 7 cm. thick. The "library" tutorials are particularly informative. One of the
first things you will have to become familiar with is the concept of "fragments". The
Mjolner system does not divide code into two worlds of "code" and "headers" like C++
does. Instead every module declares its "origin", the module from which it wishes to
inherent its context. When one module "includes" another the system parses that
module to determine its interface. The programmer doesn't have to do that by writing
a separate header file. Praise the Lord! (Information hiding is accomplished by way
of putting "local" functions/objects in inner blocks within a higher-level
function/object.) The Mjolner system views the code modules more like a database than
as simply files (but for now the modules ARE stored simply i!
!
n text files). The system figures out the dependency tree from reading the code and
determines which fragments need (re)compiling.
Now that you have the book notice that Beta stretches your head. I wrote a little
ditty on "How to Read Beta Code" ---
The goal is to vocalize the code in such a way that it can be read to a person over
the telephone in natural language yet such that they will understand it perfectly and
be able to write down the identical code.
Generally
: can be prounced "is" or "which is"
@ "an"
^ "a reference to a"
& "actually"
, "and"
(# "where"
#) "and that's that"
x[] "the x reference"
-> "enters into" or "entered into"
x.p "x's p"
; "ok?"
: (# "is generally"
y (# "a specialization of y where"
| "component" (can execute concurrently)
Examples:
point: (# x,y: @integer #)
"point is where x and y is an integer, and that's 'point' "
p: @point;
"p is a point, ok?"
topleft: ^point
botright: ^point
"topleft is a reference to a point"
"botright is a reference to a point"
topleft[] -> botright[]
"topleft reference enters into botright reference"
FlipPage: @ | VisualTransition (# ... #)
"FlipPage is a component VisualTransition where ..."
(* Note: it is important to say "enters into" rather than "to" or "becomes" or
"assigned to" because those other verbalizations are misleading. "->" is a very
powerful operation. "->" is NOT (simple) assignment. It is, technically, a
transformation operation that executes the measurement of the object on its left and
enters the resultant value (or list) into the assignment for the object on its right.
*)
Defining objects:
x: (# ... #)
"x is generally ... and that's 'x' "
x: y (# ... #)
"x is a specialization of y where ... and that's 'x' "
x: &y
"x is actually a y"
Defining a singular object:
x: & (# ... #)
"x is actually where ... and that's 'x' "
x: & y (# ... #)
"x is actually a specialization of y where ... and that's 'x' "
Virtual patterns:
x:<
"x is basically"
x::<
"x is also basically"
x::
"x is finally"
Defining functions:
enter y
say "enter 'y' " or "it is entered with y"
exit z
say "exit 'z' " or "it is exited with z"
do
say "does" or "it does"
(* Note: I find the words "class and subclass" and "superior/super and
inferior/subordinate" and "inner and outer" to be confusing because they are more
spatial concepts (to me) than logical concepts. Rather than constantly translating
code into tree diagrams or nested block diagrams in my head with constant decisions
whether to mentally draw the tree with the root node at the top or bottom I avoid
those words altogether and think, and _pronounce_, in terms of "basic" and
"specialized" things. For this reason when I see the Beta word ":<" I say "is
basically" and when I see "inner" I actually say "the specialization". Try it --- it
may help clarify things for you. *)
Example:
employee:
(# name: @text;
birthday: @date;
dept: ^Department;
totalHours: @integer;
registerWork:
(# noOfHours: @integer
enter noOfHours
do noOfHours + totalHours -> totalHours
#);
computeSalary:<
(# salary: @integer
do inner
exit salary
#);
#);
worker: employee
(# seniority: @integer;
computeSalary::<
(# do noOfHours*80+seniority*4 -> salary; 0 -> totalHours #)
#);
which is read as
"employee is generally
name, which is a text, ok?
birthday, which is a date, ok?
dept, which is a reference to a Department, ok?
totalHours, which is an integer, ok?
registerWork, which is where
noOfHours is an integer
it is entered with noOfHours
it does noOfHours plus totalHours entered into totalHours
and that's 'registerWork'
computeSalary which is basically
salary, which is an integer
it does the specialization
it exits with salary
and that's computeSalary
and that's 'employee' "
"worker is an employee where
seniority is an integer, ok?
computeSalary is also basically
where it does noOfHours times 80 plus seniority times 4
entered into salary, ok?, zero entered into totalHours
and that's 'worker' "
Credit: the example code is taken from Madsen's excellent BETA Language Introduction,
reprinted in edited form as Mjolner Informatics Report MIA 94-26(1.2) available at
<http://www.daimi.aau.dk/~beta/Manuals/r4.0/PDF/mia94-26.pdf>
Using Beta to implement a cross-platform, open-source "FreeCard" framework is an
exercise left for the reader.
p.s. BETA is not open-source (yet :-); the IDE and compiler are freely available in
executable form and all of the libraries (basic library, graphics framework,
persistent object storage, exceptions, containers, processes, etc.) are available as
Beta source code.
--
Garry Roseman
Independent Macintosh Software Developer
Memphis, TN