Retoor software development Projects Research SearchXNG
Register Sign In

13 lines
424 B
JavaScript
Raw Normal View History

feat: add await syntax for direct async function calls and new generator/phonebook apps Add compiler support for calling async functions directly with `await fn(args)` syntax, automatically translating to `await fn.call(args)`. Introduce `create_merge` Makefile target for merging Wren source files. Include new `apps/generator.wren` source code generator using OpenRouter API, `apps/phonebook.wren` CLI phonebook with SQLite backend, and `apps/minitut.md` Wren tutorial reference. Update `example/await_demo.wren` with parameterized async functions, nested awaits, and expression usage. Fix JSON parsing in `example/openrouter_demo.wren` to strip markdown code fences. Document new await syntax in `manual/api/scheduler.html`.
2026-01-25 10:50:20 +01:00
// retoor <retoor@molodetz.nl>
import "scheduler" for Scheduler, Future
var getValue = async { |x| x }
var double = async { |x| x * 2 }
System.print(1 + await getValue(2)) // expect: 3
System.print(await double(3) + await double(4)) // expect: 14
System.print(await getValue(10) * 5) // expect: 50
System.print(100 - await getValue(30)) // expect: 70
System.print((await getValue(4)) * (await getValue(5))) // expect: 20
Reference in New Issue Copy Permalink
eadfc8e9cb
wren/test/await/await_fn_in_expression.wren
Response time: 64ms
Mail Licenses API