The Hyper Programming Language |
home | language reference | compiler | hyper on launchpad |
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.
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.
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