set (value destination --)value: Value assigned to destination.destination: Already-selected destination value or Ref to the destination.set replaces an already-selected mutable same-schema destination after dereferencing both inputs. No selection happens inside the builtin.
set is the final replacement step after a separate selection form such as @NAME, .@NAME, @, or fieldRead. After dereferencing, source mutability decides whether the source is copied or moved. A Ref source differs from a direct value only by that source mutability.
set replaces the selected destination object itself. If destination is a Ref, the object reached through that Ref is replaced; the stored Ref value is not changed. Replacing a stored Ref value instead requires a combined selection-and-write form such as ! or fieldWrite.
"Owner" use
"String" use
{} () {} [
copySource: 7;
copyTarget: 0;
copySource @copyTarget set
("-- immutable value path copies -- " copySource " " copyTarget "\n") printList
moveSource: 5 owner;
moveTarget: 0 owner;
@moveSource @moveTarget set
("-- mutable value path moves -- " moveSource.valid? " " moveTarget.valid? "\n") printList
] "main" exportFunction
-- immutable value path copies -- 7 7
-- mutable value path moves -- FALSE TRUE
@NAME node source form Named local or visible-field read that can supply a selected destination for set..@NAME node source form Named field read on a popped Dict that can supply a selected destination for set.@ builtin (ordinal structValue -- selectedItem) Ordinal-based data-input selection and read with the ordinal before the Struct value.fieldRead builtin (structValue ordinal -- selectedItem) Ordinal-based data-input selection and read with the Struct value before the ordinal.!NAME node source form Direct named write when selection and replacement are combined in one source form..!NAME node source form Direct named field write on a popped mutable Dict when selection and replacement are combined.! builtin (value ordinal structTarget --) Ordinal-based data-input selection and write with the ordinal before the Struct target.fieldWrite builtin (value structTarget ordinal --) Ordinal-based data-input selection and write with the Struct target before the ordinal.