Custom Types

The following code examples demonstrate how custom types can be declared and used. See section [TBD] for details.

Type Declaration

`Declare a new type called "Special Int" to wrap around the built-in Int.`
`Default the value of this type to 0.`

Special Int: Int[0].

Flags

`Declare a new type called "Constant Int" to define a constant 
type for the value of 2.`

Constant Int: const Int[2].
`Declare a new type called "Constant Record" to define a constant 
type for an encapsulation of a couple of values that cannot be changed.`

Constant Record: const 
    {
        Value A: Int[3];
        Value B: Bool[true];
    }.
`Declare a new type called "Some Record" to define a data 
type for an encapsulation of a couple of values, with a declared constant.`

Some Record:
    {
        Value A: Int[Constant A];
        Value B: Bool[false];
    },
    Constant A: const Int[3].

Decorators

With Identifiers

With Replacements

With Removals

Accessing

Setup

Retrieving

Setting

Operators

By default, a custom type that wraps an existing type inherits the operators of the existing type, including those of built-in types. Operators declared in the declaration of a type override any matching inherited operator.

As Variables

Basic types that wrap existing types have variables that are assigned/declared the same as the existing type's variables would be. Composite/Context types are assigned/declared as follows.

Assignment

Context-Only Assignment

Declaration

Context-Only Declarations

Last updated