Easy OOPS: Classes and Objects

Simple class/object syntax with explicit `var` vs `obj` safety rules.

Core Syntax

class Person {
    var name @ str = "unknown"
    var age @ int = 0

    func Constructor(name: string, age: int) -> any {
        this.name = name
        this.age = age
        return this
    }

    func describe() -> string {
        return "Person(" + this.name + ", age=" + this.age + ")"
    }
}

obj user @ Person = Constructor("Ada", 42)
display user.describe()

`this`, `super`, and object updates

func birthday() -> int {
    this.age = this.age + 1
    return this.age
}

func superDescribe() -> string {
    return "super view => " + super.describe()
}

Type Rules (strict by design)

Rule 1: Use var only for built-in datatypes and collections.
Rule 2: Use obj only for class instances.

Expected compile-time errors

// Invalid: class type with var
var x @ Person = Constructor("Ada", 42)
// Error: Variables can only be created with built-in datatypes (or arrays/matrices).
//        Objects must be created with 'obj' from a class.

// Invalid: datatype with obj
obj x @ int = 12
// Error: Objects can only be created from classes.
//        Datatypes can only be used with 'var' declarations.