-- An exported function is callable by its BARE NAME in my-basic -- exportedFn(args), no explicit
-- calogCall -- the same convenience the hook engines (Lua/JS/Squirrel/s7) get. Resolution is
-- case-insensitive there (my-basic uppercases identifiers). Wren and Berry still use calogCall.
-- run: bin/calog examples/scripts/polyglot/bareExportInMyBasic.lua

local helper = taskSpawn("lua", [[
  calogExport("shout", function(s) return string.upper(tostring(s)) .. "!" end)
  kvSet("ready", "1")
]])
while not kvHas("ready") do timeSleep(10) end

local mb = taskSpawn("mybasic", [[
' 'shout' is a Lua export, invoked here by its bare name -- no calogCall
kvSet("out", shout("hello from basic"))
]])
while not kvHas("out") do timeSleep(20) end

calogPrint("my-basic bare-called the 'shout' export ->", kvGet("out"))
taskClose(mb); taskClose(helper)
calogExit(kvGet("out") == "HELLO FROM BASIC!" and 0 or 1)
