From cfb6df4c88dc78f01362aa1c77c0577186be8ca9 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Wed, 24 Aug 2022 16:28:52 +0000 Subject: [PATCH] Update 'Object Type Definitions' --- Object-Type-Definitions.md | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/Object-Type-Definitions.md b/Object-Type-Definitions.md index 5bef5b8..bad2e41 100644 --- a/Object-Type-Definitions.md +++ b/Object-Type-Definitions.md @@ -1,13 +1,32 @@ -Object types can be defined like this: +# Syntax ``` -objt ro Rectangle:Obj - ro x:Int - ro y:Int - ro width:Int 16 - ro width:Height 16 +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. + +# Semantics + The "type" of an object type definition is what object it inherits. Most objects will inherit from Obj, which is a blank object.