The Freya Programming Language

Constant types

See also

You can use the const modifier when declaring a class or record, to make them constant types.

Constant types

Static classes and records can be declared as in this example:

Vector = const record
    members...
end;

Complex = const class
    members...
end;

All instance fields and properties are automatically declared as read only members. Read only fields can only be modified when creating an instance, from inside the constructor.

Constant classes and records are often used as immutable types.

See also

The Freya Programming Language
Classes
Static classes
Type declarations
Nested types
Record declarations
Interface declarations
Type members