lang::elaborate

lang/src/elaborate.mo

defnames_of_decls#
pub def names_of_decls (decl_list : List Decl) : List Identifier

Collect all names from a list of declarations.

One pass carrying a string-keyed seen-set. The previous fold called union_ids per decl, whose id_member rescanned the entire accumulated tail each time -- O(n^2) String.beq at the ~4000-def whole-graph call (names_of_decls dict_paramed2, lang/module.mo), which sat at 12.0s in the 2026-09-09 self-compile profile (AGENTS.md item 27 diagnosed the shape at hello.mo scale and correctly deferred it; item 37 is why it had to be re-measured at self-compile scale).

Output is unchanged from union_ids's left bias: encounter order, first occurrence kept. id_eq is exactly String.beq of the two identifiers' strings, and show_identifier is exactly that string, so keying the set on show_identifier dedups identically to id_member. (List.dedup_by, std/list.mo, is no substitute: its own seen is a plain list scanned linearly -- the same O(n^2).)