this post was submitted on 22 Mar 2024
2 points (100.0% liked)

Zig Programming Language

157 readers
1 users here now

A lemm.ee community for Zig!

founded 1 year ago
MODERATORS
 

From the README:

This library creates bindings for accessing Javascript from within a WASM runtime

Calling Javascript functions from Zig is a pain. WASM has restrictions on the function API surface, and how references to the runtime environment (Javascript) can be stored. So to access Javascript functionality from Zig, you must create: a function in Zig which is friendly to call, a function export, and a function in Javascript which translates into the call you actually want.

This isn't too bad so far, but the Javascript API surface is large, has a lot of variadic functions, and accepts many types. The result is that your programming loop of just wanting to write code slows down writing a large amount of ill fitting boilerplate whenever you must cross the Zig to Javascript boundary.

This package is clearly inspired by Go's solution to this problem: https://pkg.go.dev/syscall/js

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here