The Hyper Programming Language

Class Types

General

Class types are the most basic types, but thay are also the most important ones. You may be able to imagine what it would be like without pointers or arrays, but doing without basic types would of course be impossible.

Since Hyper is an object-oriented programming language, the built-in primitive types are also considered classes; this in contrast to for example Java, which also claims to be object-oriented.

Syntax

A class type is simply referred to by its name. For a built-in type, this is a keyword like for example int. For a user defined class, this can be a simple name or a qualified name. To make the class type a constant type, just write the const keyword before the name of the type.

Examples

Some built-in types used:

procedure p(x : int)
  var someVariable : nat
  var otherVariable : const int = 5
end p

User defined classes also used:

class MyClass
  # ...
end MyClass

class OtherClass
  procedure test(c : MyClass, d : N.MyClass)
    var xyz : OtherClass
    var abc : string
  end procedure test
end class

See also


Valid HTML 4.01 Strict Valid CSS!