Reference · class
class
13 words. Sorted alphabetically.
Class ( -- class )
Push the primordial metaclass (class of all class definitions).
CLASS-BY-UUID ( string -- class )
Look up a class by UUID string. 'uuid' CLASS-BY-UUID → class. Resolves named and orphaned classes; param_error if the UUID has no surviving instances.
CLASS-NEW ( string string -- class )
( name uuid -- class ) Create an empty class definition with the given UUID. Build it up via chained value 'field' OBJ! and << body >> 'method' OBJ! calls, then install with REGISTER-CLASS.
IS-A? ( any class -- boolean any )
Class identity check. obj class IS-A? → bool obj. Returns true iff obj is a stack::Class instance with the same UUID as class. Obj preserved at TOS.
MEMBERS ( structured -- array class )
Push the array of this object's field names. obj MEMBERS → [ 'a 'b ... ] obj (obj preserved at TOS).
NEW ( class -- class )
Instantiate a class. class NEW returns a blank instance whose class_ref points to the definition.
OBJ! ( structured any name -- class )
Functional field write: obj value 'name OBJ! → new_obj. Produces a fresh object with the field replaced; the original is not mutated.
OBJ@ ( structured name -- any class )( structured array[name] -- any... class )
Read field(s) from a structured object. Single-name: obj 'name OBJ@ → value obj. Array-form: obj [ 'a 'b ] OBJ@ → va vb obj. Obj stays at TOS (idempotent).
PROP! ( class progn name -- class )( class progn progn name -- class )
( class get-progn [set-progn] name -- new_class ) Attach a Progn as a computed property on a class definition. 1-Progn form is read-only; 2-Progn form is read-write (OBJ! on the name invokes set-progn, OBJ@ invokes get-progn). Auto-evaluates during display (to_json includes the result); bare-name-callable inside method bodies; SEND-callable from outside. Definitions only — instances are rejected.
REGISTER-CLASS ( class string -- class )
( class name -- ) Install a class definition under the given name. Same refinement rules as before: same-UUID + compatible updates in place; same-UUID + incompatible fails; different-UUID rebinds the name (existing instances keep their class_ref).
SEND ( class... name -- any... class )
Dispatch a method on the first stack::Class instance below TOS. receiver args... 'method SEND deep-copies the receiver as working_self, pushes a live InstanceScope layer onto the runtime scope stack, executes the method body (which accesses fields via bare names + STO — writes mutate working_self in place), then pops the layer and pushes working_self. The body's self is available as a bare name and reflects all STOs landed so far.
SENDn ( name number -- any... class )
Nth-receiver method dispatch. ... 'method n SENDn dispatches to the Nth stack::Class instance scanning from TOS (1 = closest). 1 SENDn equals SEND.
UUID-NEW ()
( -- uuid ) Push a fresh RFC-4122 v4 UUID string. Use to construct a class identity at registration time when stable cross-session identity isn't needed.