flan/test/programs/nth-gone.flan
Joseph Ferano 5ea0bcae84 Remove nth, the alias that was not one
nth and at were documented as the same operation, and as reads they were:
check.ml matched "at" | "nth" in one arm. But a place is recovered in two
other spots -- parse.ml for (set ...) and place_of_expr for (addr ...) --
and both match only Sym "at". So (set (nth a i) x) and (addr (nth a i))
were refused while the at forms worked.

Two names said to be identical that disagree about writing is worse than
one name, and the asymmetry is not worth fixing in three places to keep a
synonym. at is the indexing operation; nth is gone.

The six call sites were all reads, so they rewrite directly. get/put stay
the Map pair: get returns (Option V) and is deliberately not a place.

nth-gone.flan pins the removal -- it has to fail as a name nobody defined,
not quietly resolve to at again.

destructure~nth is compiler-generated and unrelated.
2026-09-12 04:46:41 +07:00

12 lines
496 B
Plaintext

;;;; nth was an alias of at, and an asymmetric one: the checker accepted it as
;;;; a read, but parse.ml and place_of_expr both match only [at], so
;;;; (set (nth a i) x) and (addr (nth a i)) were refused while the [at] forms
;;;; worked. Two names documented as identical that disagree about writing are
;;;; worse than one name, so nth is gone and this pins the removal: it must
;;;; fail as an unknown name, not quietly resolve to at again.
(defvar a [4 i32])
(defn main [] i32
(nth a 0))