fieldName (schema ordinal -- itemName)schema: Value or Ref whose dereferenced schema is Struct and whose stored item name is returned.ordinal: Known zero-based item ordinal whose name is returned.itemName: Known Text name stored at the selected item ordinal.Returns the stored name for one selected item ordinal in the dereferenced Struct schema. Unnamed items return the empty Text "".
Only the schema participates. Current value contents do not participate.
The ordinal input is dereferenced and must be known at compile time. fieldName preserves the name at the specified ordinal. Repeated names remain repeated and empty names remain empty.
fieldName is therefore not an inverse of fieldIndex when names repeat or are empty, because fieldIndex collapses all matches to the last matching ordinal.
ordinal input must be a known Int32 in the range 0 through itemCount - 1. Out-of-bounds ordinals are invalid."".{} 0 {} [
mixed: { 1 "" def 2 "" def 3 "x" def 4 "x" def };
"-- fieldName keeps each ordinal separate --" printCompilerMessage
mixed 0 fieldName printStack _:;
mixed 1 fieldName printStack _:;
mixed 2 fieldName printStack _:;
mixed 3 fieldName printStack _:;
"-- fieldIndex collapses to the last match --" printCompilerMessage
mixed "" fieldIndex printStack _:;
mixed "x" fieldIndex printStack _:;
"-- Tuple items are unnamed --" printCompilerMessage
(1 FALSE) 0 fieldName printStack _:;
(1 FALSE) 1 fieldName printStack _:;
0
] "main" exportFunction
-- fieldName keeps each ordinal separate --
""
""
"x"
"x"
-- fieldIndex collapses to the last match --
1
3
-- Tuple items are unnamed --
""
""
fieldCount builtin (schema -- itemCount) Schema item count and valid ordinal-range upper bound.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.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.