Helpers for building interface-style wrappers and concrete implementations over named method descriptions.
(ordinal object -- fieldValue)Returns the field selected by ordinal from object.
"interface.cloneField" use
"control" use
{} () {} [
object: {value: 1; ref: 0nx Int32 addressToReference;};
0 @object cloneField printStack _:;
1 @object cloneField printStack _:;
] "main" exportFunction
Int32
Int32 NIL
(methods -- interfaceSchema)Builds one interface-wrapper schema from one method-description supplier.
methods is consumed through call.cloneField.Vtable with DIE_FUNC, SIZE, and one entry per declared method.CALL object with the same method names.CALL method forwards through the stored vtable entry with the current wrapper storage address as self.(getBase getObject -- implementationSchema)Builds one concrete implementation wrapper from one interface-base supplier and one object supplier.
getBase supplies the interface base schema.getObject supplies the concrete object used by forwarded method calls.Base, getObject, and one vtable compatible with the base interface.CALL object contains one nested base value together with moved or cloned object fields from the concrete object returned by getObject.DIE_FUNC that destroys that concrete object representation and one SIZE function that reports its storage size."interface" use
"String" use
"control" use
Mover: [{ move: {value: Int32; result: Int32;}; }] interface;
MoverImpl: [@Mover [{
move: {value: Int32;} Int32 {} codeRef;
[1 +] !move
}] implement];
{} Int32 {} [
impl: MoverImpl;
("result=" 41 @impl.CALL.move LF) printList
0
] "main" exportFunction
result=42