fieldCount (schema -- itemCount)Returns the number of items in the dereferenced Struct schema as a known Int32 value. Only the schema participates. Current value contents do not participate.
Duplicate names, unnamed items, static items, and Meta items all count separately. The result therefore counts schema items, not unique names and not runtime storage slots.
The valid selected-item ordinal range of the dereferenced schema is 0 through itemCount - 1.
0.{} 0 {} [
dict: {
x: 1;
virtual y: 2;
z: ();
x: 3;
};
"-- duplicate names still count separately --" printCompilerMessage
dict fieldCount printStack _:;
dict 0 fieldName printStack _:;
dict 1 fieldName printStack _:;
dict 2 fieldName printStack _:;
dict 3 fieldName printStack _:;
"-- Ref to Dict --" printCompilerMessage
@dict fieldCount printStack _:;
"-- List --" printCompilerMessage
(1 2 3) fieldCount printStack _:;
"-- Tuple --" printCompilerMessage
(1 FALSE) fieldCount printStack _:;
"-- empty Tuple --" printCompilerMessage
() fieldCount printStack _:;
0
] "main" exportFunction
-- duplicate names still count separately --
4
"x"
"y"
"z"
"x"
-- Ref to Dict --
4
-- List --
3
-- Tuple --
2
-- empty Tuple --
0
fieldIndex builtin (schema itemName -- ordinal) Name-to-ordinal lookup under last-match rules.fieldIsRef builtin (schema ordinal -- isRefLike) Ref-like test for one selected item schema.fieldIsVirtual builtin (schema ordinal -- hasNoStorage) No-storage test for one selected item.fieldName builtin (schema ordinal -- itemName) Ordinal-to-name lookup that preserves the stored name at one selected ordinal.has builtin (schema itemName -- hasName) Known-name presence test that does not choose an ordinal.schemaName builtin (schema -- reportedName) Reported name of the dereferenced schema.