Archived
e23319fe0b
fn(params) -> RetType { body } is now valid in expression position.
The parser produces a Lambda AST node. codegen-js emits a hoisted
JS function declaration with a generated name (__lambda_N) and returns
the name as the expression value, so inline callbacks compose cleanly:
dom_listen(btn, "click", fn(event: Any) -> Void { handle(event) })
emits:
function __lambda_1(event) { handle(event); }
dom_listen(btn, "click", __lambda_1);
The hoisted-declaration strategy is debuggable, has no closure-capture
issues, and requires no string-buffer mode in the codegen.