Opus

From the SETL Wiki

Jump to: navigation, search

Opus was a very high level language with a C++-like syntax, developed by David Cauz and Paul Church, probably sometime between 1990 and 2004.

The language featured a rich set of primitive types, including:

  • sets
  • relations
  • vectors
  • stacks
  • queues

all of which were parameterised by element type.

There was also a built-in rational number type. The programmer could also define object and tuple (similar to C struct) types and bounded integer types.

Like SETL, Opus was value-based. Although complex types can be passed by reference, there are no implicit or explicit pointers. Two variables never refer to the same object unless one is explicitly and statically declared to be an alias of the other.

A dynamic type system was used at run-time, but the syntax required that every variable was typed, and many operators were overloaded depending on the declared type. It was possible to declare a variable as a "variant" allowing it to take on a value of any type at run-time. More specialised variant types could also be defined, as the union of one or more existing types. The compiler would allow an assignment a = b; if the types a and b overlapped (i.e. had some values in common) but would flag an error if they were disjoint, e.g.

type I integer[0, 2] default 1;
type J integer[2, 4] default 3;
type K integer[4, 6] default 5;

I i;
J j;
K k;

// ...

i = j; // OK
j = k; // OK
i = k; // ERROR

The third assignment is invalid because types I and K have no values in common.

The Opus homepage was here:

http://ca.geocities.com/dcauz@rogers.com/opus/

It is no longer online, but old versions of the site can be found at the Wayback Machine. The first version listed is dated 2003 and the last 2004, but the system may have been in development for several years before it was first made available online.

It is unknown whether the language was directly influenced by SETL.

Personal tools