-- Polyglot task fan-out: one Lua script spawns a tiny task on FIVE different -- engines (JavaScript, Squirrel, Berry, Scheme/s7, Wren). Each child prints a -- one-line hello in its own language through the shared calogPrint native, so a -- single run shows all five runtimes executing side by side under one broker. -- The Scheme child is wrapped in (begin ...) because s7 evaluates one form; the -- Wren child reaches natives via Calog.call. A short timer lets every child run -- before we tear down and exit. -- Run: bin/calog examples/scripts/polyglot/taskFanout.lua -- Each entry pairs a taskSpawn engine name with a minimal, idiomatic snippet. local children = { { engine = "js", code = [[calogPrint("javascript: hello from JavaScript");]] }, { engine = "squirrel", code = [[calogPrint("squirrel: hello from Squirrel");]] }, { engine = "berry", code = [[calogPrint("berry: hello from Berry")]] }, { engine = "s7", code = [[(begin (calogPrint "scheme: hello from Scheme"))]] }, { engine = "wren", code = [[Calog.call("calogPrint", ["wren: hello from Wren"])]] }, } local handles = {} for index = 1, #children do local child = children[index] local handle = taskSpawn(child.engine, child.code) handles[index] = handle calogPrint("spawned", child.engine, "task:", handle) end -- Give all five children time to run their single print, then close and exit. timerAfter(400, function() for index = 1, #handles do taskClose(handles[index]) end calogExit(0) end)