Update 'Type Specifiers'
parent
d42c20117c
commit
b2d12c0093
@ -13,24 +13,12 @@ Int:5
|
||||
# Dynamic array of integers
|
||||
{Int ..}
|
||||
|
||||
# Static array of 5 integers, with default values
|
||||
Int:5:<398 298 17 40 98>
|
||||
|
||||
# Object that has two integer members: x and y
|
||||
Obj:(
|
||||
.ro x:Int
|
||||
.ro y:Int)
|
||||
|
||||
# Variable length array of objects that have a single integer member called x
|
||||
{Obj:(.x 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](Type-Definitions).
|
||||
|
||||
If an item is delimited by less than and greater than tokens, it is understood as a simple default value for the type. One or more arguments may be listed in this area, depending on what the length of the type is.
|
||||
|
||||
If an item is delimited by parentheses, it may contian definitions for new members, and new default values for inherited members. This construct is only understood when the type specifier inherits from another object type.
|
||||
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](Type-Definitions).
|
Reference in New Issue
Block a user