我看Dart可以编译成javascript。就花了3天把一个小项目用dart重写了一遍。然后等到部署的时候才发现,Dart编译出来的js只能在浏览器里跑。而我的目标运行环境是nodejs。整了一个大无语。
然后我想,要不试一试WASM。结果发现,WASI的标准就是个空架子。emscripten编译出来的代码在wasmtime里跑不了。搞WASI的那帮人利用LLVM又搞了一套SDK,叫WASI SDK。但是很多很多语言特性都不支持。
Nodejs终于开始尝试性的支持WASI了。文档里还特别强调:
"The node:wasi module does not currently provide the comprehensive file system security properties provided by some WASI runtimes. Full support for secure file system sandboxing may or may not be implemented in future. In the mean time, do not rely on it to run untrusted code." 重点:“may or may not be implemented in future”, 这说的都是啥话啊。
然后我又看了一半天sharedarraybuffer怎么才能启用。Chrome有chrome的要求,firefox等别的浏览器我还没查到。
唉……真是麻烦
--
FROM 223.111.166.*