复用已有的 infra 是提高效能的方法。
cpp 复用 c 的生态(c89 standard)
ts 复用 js 的生态(超集)
统一接口是一种常见方法。
目前已有的方案/现实案例大概有
ms 出的 lsp,基本统治了编辑器(lsp spec)
POSIX 让 *nix 上的跨平台简单了很多, 除了 win32api 这个异类.
rust 可以绑定到一堆语言上(opendal)
这样能做到工作量加法而不是乘法
算法 → rust 实现 → binding 到几乎所有别的语言
中间选择的也很重要,需要一门 footprint 小的,方便生成动态链接库的语言(比如 c cpp rust zig)
help someone to implement an algorithm, but need so many languages bindings.
So why not just write in one language, and codegen other language’s bindings?
For Python, just use pyo3, re-export all the public struct and magic method.
For C/C++, use cbindgen to get a cdylib, aka dll + header file, then directly use it in C/C++.
For nodejs, use napi-rs
So now we have 4 languages’ bindings, but we only need to write the algorithm for one time.
:)