fieldIsRef (schema ordinal -- isRefLike)schema: Value or Ref whose dereferenced schema is Struct and whose selected item is tested.ordinal: Zero-based item ordinal being tested.fieldIsRef is a selected-item schema predicate. It tests whether one selected item of the dereferenced Struct schema is Ref-like.
In this builtin, Ref-like means Ref, Code, or Text. Current field contents, current knownness, and current NIL status do not participate. This is a schema predicate, not a read-result predicate, so a non-static In-place item can make fieldIsRef return FALSE even though reading that item later produces a Ref-like result. A static Ref-like item can make both fieldIsRef and fieldIsVirtual return TRUE, because schema kind and runtime storage are tested separately.
ordinal is a zero-based known Int32 selected-item ordinal.TRUE means that the selected item schema is Ref, Code, or Text.Text and Code item schemas still report TRUE when a current runtime value would be unknown or NIL.Ref-like item can make both fieldIsRef and fieldIsVirtual report TRUE.In-place and Meta, report FALSE.ordinal is out of bounds for the Struct schema, the builtin raises a compilation error.{} 0 {} [
dict: {
ordinaryField: 0;
textField: 0 ("") dynamic @;
codeField: {} () {} codeRef;
metaField: ();
};
"-- In-place field schema versus read result --" printCompilerMessage
dict 0 fieldIsRef printStack _:;
@dict 0 fieldRead isRef printStack _:; _:;
"-- text field schema versus read result --" printCompilerMessage
dict 1 fieldIsRef printStack _:;
@dict 1 fieldRead isRef printStack _:; _:;
"-- code field schema versus read result --" printCompilerMessage
dict 2 fieldIsRef printStack _:;
@dict 2 fieldRead isRef printStack _:; _:;
"-- meta field schema versus read result --" printCompilerMessage
dict 3 fieldIsRef printStack _:;
@dict 3 fieldRead isRef printStack _:; _:;
tuple: (0 "" {} () {} codeRef);
"-- Tuple item schemas use the same category --" printCompilerMessage
tuple 0 fieldIsRef printStack _:;
tuple 1 fieldIsRef printStack _:;
tuple 2 fieldIsRef printStack _:;
0
] "main" exportFunction
-- In-place field schema versus read result --
FALSE
0 Ref
TRUE
-- text field schema versus read result --
TRUE
Text
TRUE
-- code field schema versus read result --
TRUE
{} () {} codeRef CNIL
TRUE
-- meta field schema versus read result --
FALSE
()
FALSE
-- Tuple item schemas use the same category --
FALSE
TRUE
TRUE
@ builtin (ordinal structValue -- selectedItem) Ordinal-based one-item read with the ordinal before the Struct value.fieldRead builtin (structValue ordinal -- selectedItem) Ordinal-based one-item read with the Struct value before the ordinal.isRef builtin (value -- value isRefLike) Current stack-value Ref-like predicate that preserves the value.fieldIsVirtual builtin (schema ordinal -- hasNoStorage) No-storage test for one selected item.fieldCount builtin (schema -- itemCount) Item count of the Struct schema.fieldIndex builtin (schema itemName -- ordinal) Selected item ordinal from item name under last-match rules.fieldName builtin (schema ordinal -- itemName) Stored item name at one selected item ordinal.has builtin (schema itemName -- hasName) Schema-level known-name presence test.schemaName builtin (schema -- reportedName) Reported name of the dereferenced schema.