Zigar 0.12.0 released

Zigar is a toolkit that lets you use Zig code in a JavaScript project. Version 0.12.0 brings improvements to C integration. node-zigar now redirects all io functions in libc to the JavaScript dev console. The default build file also adds the directory containing your Zig file as an include path so you can more easily include C stuff. A useLibc option was added so you can compile code that uses it to WebAssembly.

Usability has been improved by the addition of a compilation indicator. Before your app would just freeze in place while the Zig compiler does its thing. Now there’s a little message informing you what’s actually happening.

There’re various other minor improvements. A packed struct backed by a integer type can now be cast into a number/bigint. A tagged union can be cast into a string so you determine which field is active using the == operator.

Behind the scene there was a major clean-up of the Zig code involved. Some seriously dubious and ugly solutions were removed. Type ids are no longer generated by creating a CityHash of the typename, for instance.

Documentation was improved. There’re additional examples, including one involving the use of Zig’s package manager.

Version 0.12.0 of Zigar is designed to work with the 0.12.0 Zig compiler. For people still sticking with the 0.11.0 compiler there is Zig 0.11.2, which retains the compatibility fallbacks.

4 Likes

Cool! Ill use it in soon