← News Release ·3 min read

Pooka 0.2.0: alternatives, spreads and projections

Three small additions to the language that make everyday code shorter, and a handful of fixes that make the compiler's advice more trustworthy.

Pooka 0.2.0 is out. Download it from the release page, or run the installer again:

curl -fsSL https://pooka.run/install.sh | sh

Pattern alternatives

Match arms that do the same thing can now share one body. Alternatives work with guards, and with bindings as long as every alternative binds the same names with compatible types.

match arguments {
  [] | ["--help"] | ["-h"] -> help()
  ["--version"] | ["-V"] -> version()
  _ -> run(arguments)
}

List spreads

Lists can be built with a spread tail. It compiles straight to cons cells, so prepending stays as cheap as it should be.

let path = [first, second, ..rest]

Tuple projections

Read tuple elements by position. Projections chain, and reaching past the end is a compile-time error, not a crash.

let pair = #("owl", #(3, True))
echo pair.0
echo pair.1.0

Positions start at zero: pair.0 is the first element.

Fixes

  • Explicit annotations on local bindings are respected during generic inference, including nested containers and destructured patterns.
  • An imported module that fails to parse no longer produces a misleading “unknown module” error.
  • A function's declared signature stays available after an error in its body, so correct call sites are not blamed.

Thank you

Every one of these changes started as an issue. If something surprises you, tell us.