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= classspecifics/description= fields (stored data)details= properties (computed accessors)actions= methodsidentity= selfrepeat= newmut= 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));
}
}
blueprint Counter {
specifics {
value: Ordinal;
}
details {
current = identity.value;
}
actions {
inc(identity): Counter = repeat Counter(value: succ(identity.value));
}
}
Semantics (Lowering Sketch)
blueprintdefines a record type + constructor function.specificsbecome stored fields in the record.detailsbecome computed accessors (zero-arg methods) with implicitidentity.actionsbecome functions whereidentityis the first parameter.repeat T(...)becomes a constructor call.identityis an alias forself.