Skip to content

Wintermute 0.3.1 — value model

Choose a tag to compare

@bsmr bsmr released this 12 Jul 21:59

Opens the 0.3.x transpiler-language line: the transpiler gains a value model,
without introducing control flow yet.

  • Function parametersfunc Add(X, Y int) int transpiles to add(X, Y) ->.
    Parameter names must be uppercase-leading (Erlang variables); lowercase is
    rejected, never auto-capitalized. Exported functions now export with the
    correct arity f/N (previously hardcoded f/0).
  • Trailing returnreturn expr as the last statement of a function body
    emits expr as the function's value. Early/multi-value returns are rejected,
    pointing at 0.3.2 (they need case/if). A return before a receive is
    correctly rejected as a non-tail early return.
  • Local bindingsZ := expr becomes the Erlang match Z = expr.
    Re-assignment (=) and rebinding an already-bound name are rejected — Erlang
    variables are immutable.
  • Calls with argumentsf(A, B) transpiles to f(A, B), enabling
    self-recursion emission (Erlang's last-call optimization is free). Non-trivial
    recursion still awaits a base-case branch (case/if, 0.3.2).

Correctness is proven end-to-end by a new real-toolchain rung: a value-model
fixture transpiles and compiles with erlc to a .beam. Green unit tests alone
are not enough.

This is a review-clean, TDD-built branch: 5 subagent-driven tasks (fresh
implementer + two-stage review each), one Critical caught and fixed mid-branch
(return-before-receive), and a whole-branch opus review returning "ready to
merge". The transpiler is unchanged in scope beyond these four features; all
other constructs (operators beyond +, if/case/switch, guards, multi-value
return, cross-module calls) still error by design and are deferred to 0.3.2+.