top | item 32915084

(no title)

denisw | 3 years ago

What you linked to is WASI-libc, which is a C standard library implementation on top of WASI - which itself is more low-level and less POSIX-like. https://github.com/WebAssembly/WASI

discuss

order

IshKebab|3 years ago

Nope, the file I linked to is the WASI API, just expressed as a C header (which I find a bit easier to skim than the actual specification).

Here's the actual WASI spec:

https://github.com/WebAssembly/WASI/blob/main/phases/snapsho...

You'll find it matches the file I linked. Search for "POSIX" or "errno".

jeffparsons|3 years ago

Fortunately the idea of WASI is for it to be modular. It makes sense for them to have the APIs required to make porting existing POSIX-ish-compatible apps easy, but there are also WASI modules (I forget the proper name) in the works for much more general IO objects etc. that better abstract away the underlying OS if you're willing to invest in that.

So I guess you could summarise it as: backward compatible-ish first, and then figuring out what a neater, more idiomatic world would look like second.

It's a pragmatic approach to bootstrapping the ecosystem, and there's no need for the POSIX-alike parts to hold anyone back, at least long term. Pretty soon you will be able to write apps that target WASI that end up reading and writing files in practice without the app even knowing what a "file" is (the runtime can just hand it an abstract IO object). That's a step beyond just not knowing about things like symlinks, and seems to me like a more "web-flavoured" future that can work even for CLI/desktop apps.