our-basic CHANGELOG -- calog's modifications to upstream MY-BASIC ================================================================ Every change below is marked in-source with the comment tag "[calog fork]". Baseline: ourBasic.c.upstream (pristine upstream MY-BASIC). Run diff ourBasic.c.upstream ourBasic.c to see the full patch set. Concurrency - The _mb_allocated allocation counter was changed from `volatile` to `_Atomic`, so independent interpreters (one per calog context thread) can be created and destroyed concurrently without racing the counter. Execution already runs unlocked; only lifecycle is serialized, in the adapter. Memory - A my-basic routine (lambda) popped as a refused/errored native argument is now disposed on the error path so its scope is not leaked. (In the adapter's arg-marshal loop, src/mybasic/mybasicAdapter.c.) First-class routines -- the reason for the fork - Bare-def-as-value: in _calc_expression, a routine identifier NOT followed by '(' now pushes the routine as an operand (a first-class value) instead of raising "Open bracket expected". A script can now pass a `def` (or a lambda) to a native and store it in a variable -- required for cross-engine callbacks (pubsub / timer / export). It mirrors the array-index branch beside it; calls, recursion, and closures are unchanged. - mb_eval_routine_cold(): a new public entry (declared in ourBasic.h) that invokes a routine value from an IDLE interpreter -- one with no live call frame. It supplies the last AST node as a clean return landing and passes arguments directly. calog uses it to fire script callbacks that were registered earlier and delivered when the interpreter is otherwise idle. Constraint: a callback must be a TOP-LEVEL def/lambda (persistent scope); a routine local to a function would dangle once that function returns -- the same rule every engine's closures follow. Verified: full calog `make test` (28 binaries, 0 failed) plus the my-basic engine suite (testMyBasic / testEngineMyBasic / testPolyglot / testLoad / testTask), ASan/UBSan-clean, with def and lambda callbacks firing via timer/pubsub/export and cross-engine (a Lua task calling a my-basic def).