soma.cell

Slot methods work on declared memory slots, not local maps

Pitfall 13 of writing Soma, the programming language: a habit from another language, or a rule that surprises, with what the Soma compiler answers and the form to write.

let seen = map()
seen.set("k", 1)             // error: `.set()` is a memory-slot method and 'seen' is a local — a local map is written with brackets: `seen[k] = v`
let seen = map()
seen["k"] = 1                // local maps use bracket indexing
let v = seen["k"] ?? 0

.get/.set/.has/.delete/.keys are for memory { slot: ... } slots.