[Oberon] Oberon usage

Chris Burrows chris at cfbsoftware.com
Mon Jul 12 02:04:24 MEST 2010


>-----Original Message-----
>From: oberon-bounces at lists.inf.ethz.ch 
>[mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of spir
>Sent: Monday, 12 July 2010 12:13 AM
>
>- no string type

There IS a string type. It is "ARRAY n OF CHAR". It is just a different name
from e.g. "string[n]", "PChar", "System.String" etc. 

>- no literal notation for arrays and records/objects (center 
>:= Point{x:=0,y:=0};)

I suspect you may have been using Oberon on an operating system that doesn't
fully support its capabilities.

In Oberon you should initialise records in the Initialisation section of the
module (the body of the module). This is executed automatically at load time
and stays loaded to be used by all modules in the system until it is
explicitly unloaded. 

For example:

MODULE Graphics;

TYPE
  Point* = RECORD x, y: INTEGER END;

VAR 
  zeroPoint-: Point; (* Readonly to clients *)

BEGIN
  zeroPoint.x := 0;
  zeroPoint.y := 0;
END Module.

How the compiler effects that initialisation is totally up to the
implementor. It doesn't even have to generate executable statements if the
execution platform has some other kind of initialisation mechanism.

Then, because in Oberon you can assign entire records in a simple assignment
statement, in the client module you can simply say:

  center := Graphics.zeroPoint;

>- no initialisation

See above.

> no field default,

IMHO, Explicit is better than implicit. It does lead to a little more work
for the writer perhaps but much easier to comprehend by the reader.

> no param default

Aaargh!!! Horrors! As above. ;-)

Cheers,
Chris

CFB Software
Astrobe: ARM Oberon-07 Development System
http://www.astrobe.com







More information about the Oberon mailing list