Hybrid OOP for TKS (Draft)

This document captures the agreed hybrid OOP layer for TKS. It is a surface syntax that lowers into the existing core (functions, values, effects).

Keyword Map

  • blueprint / plan = class
  • specifics / description = fields (stored data)
  • details = properties (computed accessors)
  • actions = methods
  • identity = self
  • repeat = new
  • mut = mutable field marker

Example (Conceptual)

tks
blueprint Counter {
  specifics {
    value: Ordinal;
  }

  details {
    current = identity.value;
  }

  actions {
    inc(identity): Counter = repeat Counter(value: succ(identity.value));
  }
}

Semantics (Lowering Sketch)

  • blueprint defines a record type + constructor function.
  • specifics become stored fields in the record.
  • details become computed accessors (zero-arg methods) with implicit identity.
  • actions become functions where identity is the first parameter.
  • repeat T(...) becomes a constructor call.
  • identity is an alias for self.