WalkLang v1 / v1.9

v1 makes the current compiler path feel stable.

v1.1 makes the stable surface explicit through contract docs and conformance fixtures. It does not add project mode or data modeling.

v1.2 adds project mode without changing the v1.1 core syntax surface.

v1.3 grows the stable standard library foundation without adding file/json/matrix yet.

v1.4 makes diagnostics and walk check more useful without changing the v1 core syntax.

v1.5 prepares the v1.x compatibility line with release notes, migration guidance, deprecation policy, official install instructions, and focused compatibility fixtures.

v1.6 adds local function type inference for obvious helper functions without inferring public meaning from call sites.

v1.7 adds the stable in: expression for required-line stdin input.

v1.8 adds small terminal-game helpers on top of the existing string, array, and random modules.

v1.9 adds string interpolation for display text without changing numeric +.

Contract docs:

docs/SPEC.md
docs/SYNTAX.md
docs/STDLIB.md
docs/ERRORS.md
docs/DESIGN_RULES.md
docs/COMPATIBILITY.md
docs/DEPRECATION.md
docs/INSTALL.md
docs/MIGRATING.md
docs/PROJECTS.md
docs/RELEASE_NOTES.md
docs/STATUS.md

Function Type Inference

Typed function signatures remain valid and are still best for public APIs that need explicit contracts.

func: add(a int, b int) int
    return: + a b

Local helpers may omit parameter and return types when the body proves them clearly.

func: power_four(n)
    return: ^ n 4

If the body is ambiguous, add the annotation:

func: identity(value int)
    return: value

Inference is local to the function body. WalkLang does not infer ordinary function signatures from later call sites.

Input

in: reads one required line from stdin and returns string.

var: name = in:
var: answer = in: 'Name? '

The optional prompt is any string expression. It writes to stdout without a newline and flushes before reading. in: strips \n or \r\n, preserves all other whitespace, returns '' for an empty line, and treats immediate EOF as a runtime error.

String Interpolation

Put an expression inside {} when a string should include a display value.

imp: string

var: word = 'paddle'
var: wordLength = string.len(word)
out: 'the secret word is {wordLength} characters long'

Interpolation accepts int, float, bool, string, and nullable string values. Use doubled braces for literal braces.

out: '{{word}}'

Terminal Game Helpers

Strings can be indexed by zero-based byte position. The result is a one-character string.

out: 'walk'[1]

array.push returns a new array instead of mutating in place.

imp: array

var: guessed array[string] = []
guessed = array.push(guessed, 'w')

Use module helpers for contains checks, string building, and random choice:

imp: string
imp: random

var: words = ['dog', 'cat']
out: string.contains('dog', 'o')
out: string.concat('walk', 'lang')
out: random.choice(words)

Module Rules

User modules are sibling .walk files imported by bare name.

# math_extra.walk
func: cube(x int) int
    return: * x x x

exp: cube
# main.walk
imp: math_extra

out: math_extra.cube(3)

Rules:

  • imp: name loads name.walk from the importing file's directory unless name is a built-in module.
  • Imported calls stay namespaced: math_extra.cube(3).
  • Only functions named by exp: are callable from another file.
  • Private helper functions may be used inside the module but not through the imported namespace.
  • Module files may contain only imp:, func:, and exp: at top level.

Stable Built-In APIs

math.sqrt(number) -> float
math.pow(number, number) -> float
string.len(string) -> int
string.at(string, int) -> string
string.contains(string, string) -> bool
string.concat(string, string) -> string
array.len(array[T]) -> int
array.contains(array[T], T) -> bool
array.push(array[T], T) -> array[T]
time.now() -> int
random.int(int, int) -> int
random.choice(array[T]) -> T
testing.assert(bool) -> bool

Diagnostics And Warnings

The CLI prints the stable diagnostic first line, followed by source snippets, caret locations, and focused suggestions when obvious.

The checker emits warnings for shadowing outer names and unreachable statements.

go run ./cmd/walk check examples/v1.walk
go run ./cmd/walk check --warnings=off examples/v1.walk
go run ./cmd/walk check --warnings=error examples/v1.walk

Build Flow

Native builds still go through generated C and cc.

Install the local CLI first:

scripts/install-local.sh v5.7-local
walk version
walk build examples/v1.walk -o build/v1 --release
./build/v1

Use a different C compiler or flags when needed:

walk build examples/v1.walk -o build/v1 --cc clang --cflag -Wall

Run the v1 stress path:

scripts/stress-v1.sh

Run the focused v1 compatibility suite:

go test ./cmd/walk -run TestV19CompatibilitySuite

Build release CLI artifacts:

scripts/release.sh v5.7.0

Project Mode

walk init hello
cd hello
walk check
walk build
walk test
walk fmt
walk clean

Project mode is defined in docs/PROJECTS.md.

Run v1 conformance:

go test ./...