Update 'Object Type Definitions'

Sasha Koshka 2022-08-30 05:58:19 +00:00
parent f385c2747d
commit b0a18bcb2c

@ -0,0 +1,41 @@
# Syntax
```
objt ro Basic:Obj
ro that:Basic
ro this:Basic
objt ro ComplexInit:Obj
ro whatever:{Int 3}
230984
849 394580
ro complex0:Bird
.that 98
.this 2
ro complex1:Bird
.that 98902
.this 235
ro basic:Int 87
```
Object section syntax allows for members to be declared underneath it. It must have a type that it inherits from. It should not have anything after the type specifier.
Currently, object section syntax does not support nested object definitions.
Each member should start with a permission, then have a name, then a type specifier. After that,
they can have an optional initialization value.
Arf supports bitfields, like in C, although it is done with an amperseand symbol. This is a member of type integer with a width of 1:
```
ro someMember:Int & 1
```
# Semantics
The "type" of an object type definition is what object it inherits. Most objects
will inherit from Obj, which is a blank object.
Object definitions have a list of members, preceded by a permission. Members can
have simple or complex initializations, or none at all. These act as the default
values for those members.