@ (ordinal structValue -- selectedItem)selectedItem: Stack value produced by reading the selected item.Reads one selected item by zero-based item ordinal, with the ordinal before the Struct value.
Builtin @ does not call callable items automatically.
ordinal input must be a non-NIL Int32.structValue was reached mutably and an immutable Ref otherwise.fieldIsRef and fieldIsVirtual describe the selected item schema, not the stack result produced by @. A non-static In-place item can therefore yield a Ref result even when fieldIsRef is FALSE, while a static or Meta item can still yield a copied or newly constructed result even when fieldIsVirtual is TRUE.
In the example below, each heading performs the mutable read first with @dict, then the immutable read with dict.
{} 0 {} [
value: 7;
dict: {
ordinaryField: 1;
referenceField: @value;
staticField: 2 virtual;
textField: 0 ("") dynamic @;
codeField: {} () {} codeRef;
metaField: ();
};
list: (1 2);
ordinal: 0 dynamic;
"-- In-place item --" printCompilerMessage
0 @dict @ printStack _:;
0 dict @ printStack _:;
"-- Ref item --" printCompilerMessage
1 @dict @ printStack _:;
1 dict @ printStack _:;
"-- static item --" printCompilerMessage
dict 2 fieldIsVirtual printStack _:;
2 @dict @ printStack _:;
2 dict @ printStack _:;
"-- text item --" printCompilerMessage
3 @dict @ printStack _:;
3 dict @ printStack _:;
"-- code item --" printCompilerMessage
4 @dict @ printStack _:;
4 dict @ printStack _:;
"-- meta item --" printCompilerMessage
5 @dict @ printStack _:;
5 dict @ printStack _:;
"-- uniform struct through unknown ordinal --" printCompilerMessage
ordinal @list @ printStack _:;
ordinal list @ printStack _:;
0
] "main" exportFunction
-- In-place item --
1 Ref
1 Cref
-- Ref item --
7 Ref
7 Cref
-- static item --
TRUE
2
2
-- text item --
Text
Text
-- code item --
{} () {} codeRef CNIL
{} () {} codeRef CNIL
-- meta item --
()
()
-- uniform struct through unknown ordinal --
Int32 Ref
Int32 Cref
.@NAME node source form Named field read without calling..NAME node source form Named field mention and call if callable.! builtin (value ordinal structTarget --) Ordinal-based one-item write with the ordinal before the Struct target.callField builtin (dict name -- fieldResult) Known-name data-input Dict field selection with .NAME-style semantics.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.fieldRead builtin (structValue ordinal -- selectedItem) Ordinal-based one-item read with the Struct value before the ordinal.fieldWrite builtin (value structTarget ordinal --) Ordinal-based one-item write with the Struct target before the ordinal.