You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Language decision: expression-bodied fn / getter does not return its value #60
fn double x to x mul 2 compiles to function double(x) { x * 2; } (no return), and get fn value to this.count to get value() { this.#count; }. The examples document this as "expression body (no return)" and require to return expr.
This is surprising for users coming from arrow-function style (x => x * 2) and silently produces undefined. The compiler could warn today.
Options
Keep the semantics, add a diagnostic/linter rule: "expression body has no effect, did you mean to return?" (non-breaking).
Make to expr return the expression (breaking change for code that relies on the statement form; needs a major version or an opt-in flag).
Introduce a distinct arrow-style form and leave to unchanged.
Needs a maintainer decision; option 1 can ship regardless.
Decision (#91): keep the semantics (changing them is breaking, major only). The linter warns on named fn / getter expression bodies without return (rule expression-body-no-return) and the RFC documents it. Anonymous 'fn x to expr' already returns.
Activity
feat: release build of the compiler (526 KB), linter rule expression-…
otnc commentedon Oct 16, 2026
Decision (#91): keep the semantics (changing them is breaking, major only). The linter warns on named fn / getter expression bodies without return (rule expression-body-no-return) and the RFC documents it. Anonymous 'fn x to expr' already returns.