2 Type Specifiers
Sasha Koshka edited this page 2022-10-12 07:34:39 +00:00

In ARF, a type can be described using a type specifier. Syntactically, type specifiers are lists of items that are joined together with colons.

# Simple integer
Int

# Static array of 5 integers
Int:5

# Pointer to a single integer
{Int}

# Dynamic array of integers
{Int ..}

# Static array of 5 integers
Int:5

The first item is always the name that the type inherits from. If the first item is wrapped in curly braces, the type specifier describes a pointer to whatever type is inside of it. If, after the type that is inside of it, there is an elipsis token, the type specifier describes an array of dynamic length.

If an item is a UInt token, it defines a static for the type. The type becomes an array of static length. This number cannot be zero, and if no number is given, the length is assumed to be one (which just means it is a singlular value).

If an item is a name token with the value mut, the data that the type directly holds becomes mutable. This is only understood if the type specifier is being instantiated in-place—it does not have an effect in type sections.