Zevic 0.2.0: closures and the GC
v0.2.0 brought lambdas and closures, defer and garbage collection.
let double: fn(I32) -> I32 = (x: I32) => x * 2
mut total: I32 = 0
nums.Each((x: I32) => { total += x })
A lambda can capture mut variables from outside, and the changes are visible outside. Captured variables are managed by the GC.
Memory is now handled by the Boehm GC (runtime/third_party/bgc). The runtime and the GC are compiled once on the first build and cached in ~/.cache/zevic, so later builds are faster.
C interop grew as well. Named functions and lambdas that capture nothing can be passed to C as callbacks, for example to qsort. Handle<T> lets the C side hold a Zevic object as a number.