Update 'Object Type Definitions'
parent
6b47f6d5c0
commit
cfb6df4c88
@ -1,13 +1,32 @@
|
|||||||
Object types can be defined like this:
|
# Syntax
|
||||||
|
|
||||||
```
|
```
|
||||||
objt ro Rectangle:Obj
|
objt ro Basic:Obj
|
||||||
ro x:Int
|
ro that:Basic
|
||||||
ro y:Int
|
ro this:Basic
|
||||||
ro width:Int 16
|
|
||||||
ro width:Height 16
|
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.
|
||||||
|
|
||||||
|
# Semantics
|
||||||
|
|
||||||
The "type" of an object type definition is what object it inherits. Most objects
|
The "type" of an object type definition is what object it inherits. Most objects
|
||||||
will inherit from Obj, which is a blank object.
|
will inherit from Obj, which is a blank object.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user