Live data from Hacker News

Standardizing WASI: A system interface to run WebAssembly outside the web

hacks.mozilla.org

171–180 of 238 posts

Re: Standardizing WASI: A system interface to run WebAssembly outside the web

#171

Earlier quoted context omitted.

> The JVM doesn't run languages that weren't designed for it, like C or C++ or Rust. You can run all those languages on top of the JVM! The JVM also runs many other languages which weren't designed for it, like Ruby and Python.

> You can run all those languages on top of the JVM! Do you have a source for this? I'm sure it's theoretically possible in a Turing-completeness sense, but considering Java lacks any concept whatsoever of a pointer, and considering that most (if not effectively all) C code uses pointers pretty extensively, I find it unlikely that this statement is meaningfully true without some severe efficiency penalties.

For example Sulong runs C, C++, Rust https://llvm.org/devmtg/2016-01/slides/Sulong.pdf.

I use it to run unmodified C extensions for the Ruby programming language on top of the JVM.

Truffle C is another example https://www.manuelrigger.at/downloads/trufflec_thesis.pdf.

Re: Standardizing WASI: A system interface to run WebAssembly outside the web

#172

ok, so I hate to be this guy and I'm going to do it anyway because it has to be said: Did they just invent Java again? Aren't they promising what Java promised? Won't they hit the same problems that Java hits during its write-one-run-anywhere promises? I'm asking honestly - why is WebAssembly outside of the browser needed?

> Did they just invent Java again?

No. Like Java, they just reinvented DEL again:

https://tools.ietf.org/html/rfc5

Re: Standardizing WASI: A system interface to run WebAssembly outside the web

#173

Earlier quoted context omitted.

How will you deal with valid paths such as: /tmp/[DE][AD][BE][EF].txt # ext2 / linux # OR C:\stuff\[DEED][FFFE].txt # ntfs / windows # where [hex] indicates a single filesystem charater with that value

One fun thing about the capability model is that at the system call level, there are no absolute paths. All filesystem path references are relative to base directory handles. So even if an application thinks it wants something in C:\stuff, it's the job of the libraries linked into the application to map that to something that can actually be named. So there's room for the ecosystem to innovate, above the WASI syscall…

That’s good to know, but the parent’s examples seem to be referencing the issue of filenames that aren’t valid Unicode. The Linux example is invalid UTF-8, since Linux filenames are natively arbitrary byte sequences. The Windows example contains an unpaired surrogate followed by the reserved codepoint 0xfffe, since Windows filenames are natively UCS-2.

Re: Standardizing WASI: A system interface to run WebAssembly outside the web

#174
post #97
post #91

Wait a second... I thought Java was supposed to do this with the JVM... I thought .Net was supposed to do this with the CLR... What's different now?

Different use cases. You don't necessarily want a 10 ton standard library for every use case, like on embedded devices or plugins for a software package. C/C++/Rust being 1st class citizens is also very useful.

.NET's '10 tonne' standard library is a decent part of what makes it so usable. And it's not exactly massive either - I can publish a standalone .NET Core app that's only around 30MB in size. For the usability and GC, I'll take that over C any day.

Re: Standardizing WASI: A system interface to run WebAssembly outside the web

#175

Earlier quoted context omitted.

I think the browser shouldn't be a platform at all, frankly, and WASI is one possible way we can finally stop trying to shoehorn it into being one. If everything runs a WASI runtime, which is designed to run applications from the ground up, there really isn't any need for the browser to run applications anymore, is there?

I think the world in which the browser disappears and all we have is apps is a worse world than the one we have now. With HTML/CSS we get the relatively easy ability to add extensions to dig deep into the data of a page. One of my favorite extensions is rikaikun which adds popup translation of Japanese words. It can only do this because it can inspect a standardized data structure (the DOM) with standardized APIs. I…

What you’ve mentioned about HTML/CSS is true for native apps too: there is a standardized API for drawing the UI (GTK+, Cocoa, whatever Windows has) and standardized data formats that back them. The issue is that apps are not necessarily required to use these (ironically it’s Electron et al. that break these) and they don’t use code that is readily inspectable, unlike pure JavaScript. On the other hand, though, this has been slowly been becoming true of the modern web: websites are ditching the DOM for React/Vue/Angular “SPAs” that use horrible selector names and minimized and nigh-impossible to comprehend JavaScript so they can reimplement things that the platform provides for free. So it’s not great either way…

Re: Standardizing WASI: A system interface to run WebAssembly outside the web

#176
post #59

Earlier quoted context omitted.

POSIX != C and from what i understand from the official docs, they already have a (musl derived, even) C library.

The C stdlib is so married to POSIX they may as well be the same thing.

…on UNIX systems. C is still a thing for other platforms e.g. embedded where POSIX is not a thing.

Re: Standardizing WASI: A system interface to run WebAssembly outside the web

#177

Earlier quoted context omitted.

> You can run all those languages on top of the JVM! Do you have a source for this? I'm sure it's theoretically possible in a Turing-completeness sense, but considering Java lacks any concept whatsoever of a pointer, and considering that most (if not effectively all) C code uses pointers pretty extensively, I find it unlikely that this statement is meaningfully true without some severe efficiency penalties.

For example Sulong runs C, C++, Rust https://llvm.org/devmtg/2016-01/slides/Sulong.pdf . I use it to run unmodified C extensions for the Ruby programming language on top of the JVM. Truffle C is another example https://www.manuelrigger.at/downloads/trufflec_thesis.pdf .

Thanks to GraalVM. Well, that wasn't always the case and it prompted the need for WASM.

Re: Standardizing WASI: A system interface to run WebAssembly outside the web

#178
post #173

Earlier quoted context omitted.

One fun thing about the capability model is that at the system call level, there are no absolute paths. All filesystem path references are relative to base directory handles. So even if an application thinks it wants something in C:\stuff, it's the job of the libraries linked into the application to map that to something that can actually be named. So there's room for the ecosystem to innovate, above the WASI syscall…

That’s good to know, but the parent’s examples seem to be referencing the issue of filenames that aren’t valid Unicode. The Linux example is invalid UTF-8, since Linux filenames are natively arbitrary byte sequences. The Windows example contains an unpaired surrogate followed by the reserved codepoint 0xfffe, since Windows filenames are natively UCS-2.

WTF-8 could solve the windows issue and I think for Linux it’s time to demand unicode filenames :)

Re: Standardizing WASI: A system interface to run WebAssembly outside the web

#179
post #119

Earlier quoted context omitted.

Eh, I'm not trying to discourage you from building cool apps on top of WASI. I just hope you understand what you're up against. And most of it is not technical; you've got to convince Apple to include a WASI runtime on iOS (among others).

Just like any new feature added to the web standard requires that Apple actually implement it in Safari, right? I'm not really pro-WASI so much as I am against the idea that the browser is a good application platform.

Right, just like that. They are totally comparable, adding a new feature to an existing runtime is just as hard to convince as adding a new runtime itself. Totally comparable.

Re: Standardizing WASI: A system interface to run WebAssembly outside the web

#180

Earlier quoted context omitted.

you can use html/css/js with it, I guess :/ Or, more accurately, its easy to make UIs for it? I'm personally bearish on the whole idea from a community / technical standpoint (in that I'd like us to return to more native stuff than follow JS into the browser), but I can't argue that WASM and co won't enable some really cool uses.

I can't shake the niggling idea that this, just like node before it, is more or less a way for JS web devs to not have to leave the ecosystem they're comfortable with and learn a new language. We already have hundreds of ways to write native UI applications, but web devs can't bother to use them.

Couldn't a native developer also take advantage of wasm/wasi to build their native application to a single build target/binary, which could then be run on Any machine?
Post reply on HN