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`.
This commit is contained in:
2026-01-25 09:50:20 +00:00
parent e0cc7791e3
commit eadfc8e9cb
48 changed files with 1543 additions and 86 deletions
+20
View File
@@ -0,0 +1,20 @@
// retoor <retoor@molodetz.nl>
import "scheduler" for Scheduler, Future
var moduleDouble = async { |x| x * 2 }
var moduleAdd = async { |a, b| a + b }
class Helper {
static useModuleVar(x) {
return await moduleDouble(x)
}
static combineModuleVars(a, b) {
return await moduleAdd(await moduleDouble(a), await moduleDouble(b))
}
}
System.print(await moduleDouble(10)) // expect: 20
System.print(Helper.useModuleVar(15)) // expect: 30
System.print(Helper.combineModuleVars(5, 10)) // expect: 30