Built-in classes

Sather - A Language Tutorial
Prev |  | Next

# Chapter 12. Built-in classes

This section provides a short description of classes that are a part of every Sather implementation and which may not be modified. The detailed semantics and precise interface are specified in the class library documentation.

# 12.1. Fundamental Classes

There are a handful of classes that are specially recognized by the compiler and are implicitly and explicitly used in most Sather code.

## 12.1.1. $OB

`'$OB'` is automatically a supertype of every type. Variables declared to be of this type may hold any object. It has no features.

## 12.1.2. Array support

Sather objects may have an array portion, which is specified by including either the primitive reference of value array

- `'AREF{T}'` is a reference array class. Any reference class which includes it obtains an array of elements of type `T` in addition to any attributes it has defined. In such classes, `new` has a single integer argument that specifies the size of the array portion. It defines routines and iters named: '`asize`', '`aget`', '`aset`', '`aclear`', '`acopy`', '`aelt!`', '`aset!`', and '`aind!`'. Array indices start at zero.

- '`ARRAY{T}`' includes from '`AREF`' and defines general purpose array objects. They may be directly constructed by array creation expressions.

- '`AVAL{T}`' is the immutable class analog of '`AREF`'. Classes which include '`AVAL`' must define `asize` as an integer constant which determines the size of the array portion.

Prev | Home | Next
Invariants |  | Tuples