interface

Helpers for building interface-style wrappers and concrete implementations over named method descriptions.


cloneField (ordinal object -- fieldValue)

Returns the field selected by ordinal from object.

Examples

"interface.cloneField" use
"control" use

{} () {} [
  object: {value: 1; ref: 0nx Int32 addressToReference;};
  0 @object cloneField printStack _:;
  1 @object cloneField printStack _:;
] "main" exportFunction

Expected Output During Compilation

Int32
Int32 NIL

interface (methods -- interfaceSchema)

Builds one interface-wrapper schema from one method-description supplier.


Generated interface shape


implement (getBase getObject -- implementationSchema)

Builds one concrete implementation wrapper from one interface-base supplier and one object supplier.


Generated implementation shape


Examples

Generated implementation call

"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

Expected Output

result=42

See also