newVarOfTheSameType (schema -- newValue)schema: Value or Ref whose dereferenced schema is copied for the new value.newValue: Fresh value created only from the dereferenced schema, without using current contents.newVarOfTheSameType is a fresh-value creation builtin that uses only the dereferenced schema of its input.
The input may be a value or Ref, but current contents, current access path, and NIL status are ignored. Only the dereferenced schema participates. Unlike new, current Ref contents, current access path, and NIL status never participate here. Applying const or unconst to a Ref input therefore does not change this builtin’s behavior.
NIL Ref input is valid whenever its dereferenced schema is valid for newVarOfTheSameType.{} 0 {} [
template: 7;
"-- current contents are ignored --" printCompilerMessage
template newVarOfTheSameType printStack _:;
template newVarOfTheSameType known? printStack _:;
"-- access path is ignored --" printCompilerMessage
@template newVarOfTheSameType printStack _:;
@template newVarOfTheSameType known? printStack _:;
"-- known NIL Ref still uses schema --" printCompilerMessage
0nx template addressToReference newVarOfTheSameType printStack _:;
0nx template addressToReference newVarOfTheSameType known? printStack _:;
"-- meta schema --" printCompilerMessage
() newVarOfTheSameType printStack _:;
() newVarOfTheSameType known? printStack _:;
0
] "main" exportFunction
-- current contents are ignored --
Int32
FALSE
-- access path is ignored --
Int32
FALSE
-- known NIL Ref still uses schema --
Int32
FALSE
-- meta schema --
()
TRUE
new builtin (value -- newValue) Creates a fresh value from a Ref value, Block, or Meta value; unlike newVarOfTheSameType, Ref contents and NIL status participate, so immutable Ref values copy, mutable Ref values move, and known NIL Ref values are invalid.set builtin (value destination --) Replaces an already-selected mutable same-schema destination.