◄ WORLD V · SONNY 5DART 328 · a helldive at the net

THE INVADE write into a cell — and the original still survives

To invade a cell is to write a new value into it. In a mutable language this is destruction — the old value is gone. In i13 it is not: v[k]←e yields a new tape, and the old tape persists, untouched. So you can invade the core with 99 and still read the original 4 from the array you started with. This is a persistent (immutable) update — the invasion forks history rather than overwriting it. Its mirror is dart 339, the collaborate: invasion overwrites a cell with one value; collaboration merges two into one. Overwrite versus join — the two ways a cell can take on a new state.

THE TECHNIQUE v[k]←e yields a NEW tape; the original persists (immutable update)

The demo invades the core with 99 — then reads the original tape, still intact: live demo


HISTORY & CREDIT persistent data structures · 1986

“Writing to a cell destroys what was there.” — under value semantics a write forks a new version; the old survives. Invasion without destruction. cited

1986 · Driscoll, Sarnak, Sleator & Tarjan — “Making Data Structures Persistent”: an update yields a new version while old versions remain queryable.
copy-on-write · the systems twin; the value-semantic write i13 performs.
mirror · dart 339, the collaborate: overwrite (one wins) vs merge (both fold in).

The new tape holds 99; the old tape still holds 4. To invade is to fork, not to erase. persistence, 1986

RECOMMEND FOR I-13 the non-destructive write, on the compiler

On the canonical compiler, invading the core with 99 leaves the original core reading 4 — both versions coexist:

$ i13 run d_invade.i13 # v[4] <- 99, then read the ORIGINAL RUN OK · 42 step(s) · peak stack 11 · call depth 1 new_core = 99 -- the invaded tape orig_core = 4 -- the original, untouched (value semantics)
Recommend, with an honest keeper note: the invade shows i13's most distinctive habit — non-destructive update. It is tempting as a keeper (a correct mutable write LACKS the surviving original, a real supplement). But the survival is i13's language semantics, not a mechanism choice within it: every correct i13 program has it by construction, so i13 witnesses persistence rather than a mechanism enacting it — the B39 death test (coextensive with correctness → NULL). Still, this free survival is why the batch's palindrome comes home (dart 336, the restore): the original is always there to return to.