virtual (--)virtual is the declaration modifier that marks the next successfully created local as static.
The name is historical. The resulting field-storage property is what fieldIsVirtual reports. The value-level Meta test is virtual?.
The builtin sets a pending static specifier in the current scope. That pending specifier is consumed by the next successful local creation through NAME: ...; or def.
exportFunction, importFunction, and importVariable.overload or private specifiers coexist with the pending static flag.{} 0 {} [
virtual staticLocal: 1;
dict: { virtual 2 "staticField" def };
"-- values created with virtual are static, not meta --" printCompilerMessage
staticLocal printStack _:;
staticLocal virtual? printStack _:;
dict.staticField printStack _:;
dict.staticField virtual? printStack _:;
"-- fieldIsVirtual sees static field storage --" printCompilerMessage
dict 0 fieldIsVirtual printStack _:;
0
] "main" exportFunction
-- values created with virtual are static, not meta --
1
FALSE
2
FALSE
-- fieldIsVirtual sees static field storage --
TRUE
NAME: ...; node — Pushes a name onto the name stack and creates a local by consuming that name and one data-stack value.def builtin (value name --) Creates a named local or field using a known Text name.exportFunction builtin (inputsSchema output options callable name --) Exports a named function built from a Block and a signature; a pending virtual specifier is invalid there.importFunction builtin (inputsSchema output options name --) Declares or imports a named function with the supplied signature; a pending virtual specifier is invalid there.importVariable builtin (schema name --) Creates a local that refers to external variable storage; a pending virtual specifier is invalid there.fieldIsVirtual builtin (schema ordinal -- hasNoStorage) No-storage test for one selected item.static builtin (--) Reserved builtin name with no standalone effect.virtual? builtin (schema -- isMeta) Historical Meta-schema test.