GALA-E0023 — Undefined variable

What it means. A name has no binding in the current environment. Three usual causes:


Code that triggers it

package main

func main() {
    Println(x + 1)
}

Compiler message

error[GALA-E0023]: undefined: x
  --> e0023.gala:4:13
  |
4 |     Println(x + 1)
  |             ^ check the spelling, add the import that introduces this name…
  |
  = hint: check the spelling, add the import that introduces this name, or declare it — every identifier must resolve to a binding, a declaration in this package, or an imported symbol

The diagnostic is framed and carries the offending identifier’s own span, so the caret lands on the name itself.


How to fix it

Fix the typo, add the import that introduces the name, or move the reference inside the scope where it is bound. Pattern bindings only exist inside their own arm:

val label = shape match {
    case Circle(r) => s"circle r=$r"     // r is bound here
    case Square(s) => s"square s=$s"     // ...and s only here
}

If the name is meant to come from a dot-imported package, confirm the import is present in this file — sibling files’ imports do not propagate. That case reports as GALA-E0025 instead, which names the package you are missing.


Why the rule exists

Undefined names are the most common failure during early development, and the alternative was letting them fall through to the Go compiler, which reports them against generated code. Resolving every identifier at the GALA level keeps the error on the line you wrote, and the stable code lets editors and CI tools attach extra context.

Scope. Identifier resolution. A name that resolves to a known symbol in a package this file did not import gets the more specific GALA-E0025. Type mismatches between names that both resolve are GALA-E0021, most of which are still left to the Go compiler.