`binaryen.js` seems to not longer be maintained
The Binaryen.js repo seems to not be active for at least a year. PRs are not reviewed, issues are not answered, no recent commits, only automatic ones. Are there any up-to-date ports?
I started to create my own TypeScript wrapper for Binaryen, and I have some questions. Should reference types be nominal or should they be just aliases to numbers? Nominal types are defined like this:
declare const __BinaryenExpressionRef: unique symbol;
export type BinaryenExpressionRef = number & { [__BinaryenExpressionRef]: void };
as opposed to number aliases:
export type BinaryenExpressionRef = number;
Also, TypeScript allows to make typings more strict for some aspects of Binaryen. For example, it is possible to check expression types at compile time. Should the typings be kept simple (like in the C API), or is it OK to use advanced features of TS compiler?
cc @dcodeIO for the AssemblyScript repo
PRs welcome, of course, though seems that ship has sailed.
@dcodeIO, to clarify, you do still consider the AssemblyScript/binaryen.js repo to be maintained and you do still accept PRs for it? I'm not sure whether you meant the "ship has sailed" on people sending PRs or on the repo being maintained.
The actual JS bindings are part of this repo, WebAssembly/binaryen. AssemblyScript/binaryen.js only contains TypeScript type definitions and the CI job that builds/bundles Binaryen and publishes to npm.
@tlively We are, of course, accepting PRs. I also went ahead and addressed some of the typing changes that had accumulated since the last time I checked - modulo the more recent PRs OP seems to be working on.
More broadly, it's probably true that things haven't been as smooth as they were back when I was quietly holding a bunch of this together. That's the nature of invisible work: you only notice it when it stops. Here, AssemblyScript/binaryen.js is just the last link in the chain - where issues tend to surface, but rarely originate.
In any case, you know how to reach me if a helping hand on the Binaryen end of things would be useful and worth supporting.
Should reference types be nominal or should they be just aliases to numbers?
Nominal. For these reasons:
- Even though the references are technically numbers, you probably don't want to do any calculations with them on the TypeScript side. You only pass the references back into binaryen.
- You don't want to mix up the different kinds of references. For example, you don't want to pass an
ExpressionRefwhere aFunctionRefis expected.
I am using a copy of https://github.com/AssemblyScript/binaryen.js/blob/main/index.d.ts with modified reference types. For example, I replaced
type ExpressionRef = number;
with
const enum ExpressionRef {}
This way my editor (or actually the TypeScript language server) understands far better what I can reasonably do with these values.
Find it at https://github.com/hcschuetz/fft/blob/main/fft-mylang/src/tweaked-binaryen.d.ts but notice that it is based on an older version of the original .d.ts file