immutable (deep immutability, once-evaluated item level, NK1331)Open and answer this issue on GitHub.
ready · opened 2026-11-03 · updated 2026-11-03 · 1 comment
Build ADR-389: immutable, a binding whose value nothing reachable from it ever changes (Part I 2.1, NK1331 in Part III C.3).
Probe (refused today, the word is not reserved yet):
immutable DUMP_DIR: String? = env::var("NIKAIA_DUMP_ACCEPTED")
fn main() {
immutable limits = [1, 2, 3]
let a = async fn { print(f"{limits.len()}") }
}
immutable on the reserved list.pub.SharedMut, Locked, a channel end or another shared changeable handle is refused with NK1331, naming the path; no ref mut self calls, no moves out.immutables is refused (D4), both NK1331.immutable capture or argument gets no copy, no count and no NK2101 (D3).LazyLock); function level as a plain binding.tests/compiler/ for each rule and each refusal.accepted_dump_dir() in the move of check_walked (#125).Generated by Claude Code
Step 1 also puts immutable on the reserved-word list of Part I 2.1 (the text block under Reserved words) and adds, before the comptime paragraph there: “immutable is reserved for its construct: a binding whose value nothing ever changes, deeply, where an item stands or inside a function body (2.1).” The page held it before the parser did and from_is_a_name::the_page_and_the_table_list_the_same_words went red, so ef80da01 took it out until this build. Note: the compiler’s own .nika uses immutable as a field name (found.immutable, local.immutable); rename those in the same build.
Generated by Claude Code