There's the function signature, right? So, that's the arguments that the function takes, the size of it, the number of functions that we're exporting. There's the export section, which is the keyword export, the size of that section, the number of exports. And as we keep going, there's the export section, which is just some more like the name of the export, you know, the function section, which is actually like the code inside of it, the logic of that section and how we're manipulating some of the variables that are passed into it, and then finally the end, which denotes like the end of that binary block. And really, again, you're not going to need to have this memorized, but it's still something interesting, and if you want to read more about it, you can find the binary specification on GitHub.
So now, let's actually consider the history of Wasm. It started back in 2011, which is a long time ago, before I was even really a dev. You could use Emscripten to compile C and C++ all the way back in 2011 to something that would run in the browser. Google had their own version of something Wasm-like called the Native Client, or NACL, and then in 2013, ASM.js was introduced, and ASM.js was JavaScript code that would then be passed to this like ASM.js compiler for the browser to then optimize and run it, and it was very interesting, because you would write JavaScript code, but you would annotate maybe the type of a certain variable to let it know that it would be a float or an integer or things like that. And then in 2015, Wasm itself was first announced, that actual binary format. NACL was then deprecated a couple of years later in favor of Wasm, because Google decided that, yeah, why build something and maintain it themselves when they could actually support an open standard. Broad browser support came around that same time. After that, we got a thing called Wasi, which is the WebAssembly system interface, which I'll go into a little bit more here in a bit. In 2019, Wasm threads were enabled by default in Chrome, and in 2022, Wasm 2.0, a draft for it was created. There's a little bit of contention around that draft and how that works, but we're not going to dig into that too much right now. It may just be worth reading on your own.
So Wasi is the WebAssembly system interface. It's designed by Mozilla, and it provides a POSIX-like feature set, so you can get like file I.O. or networking or things that like your operating system kind of handles for you that when you compile a binary for a certain operating system, those are the bindings that are actually kind of being wired up for you to that binary. So instead, Wasi helps you do that with Wasm code, and when you combine those things together, you get something very powerful. Solomon Hikes, the creator of Docker, once said in 2019, if Wasm and Wasi existed in 2008, we wouldn't have needed to create Docker. That's how important it is. WebAssembly on the server is the future of computing. Just think about that, like really powerful. So the portability that we would get to run Wasm in the Web would also mean we could get that portability at the server level, and you know, we wouldn't need Docker at that point as long as there is a Wasi interface to expose these things for us. And as long as our dependencies could compile to Wasm as well. My favorite talk and example of what this future could look like is The Birth and Death of JavaScript by Gary Bernhardt. Now, the title is misleading. He's not actually anti-JavaScript. He has some very good points about how it's not a perfect language, of course, because there's no such thing. But he goes through and points out that because JavaScript is the way it is, it led to the future that we're seeing where people are pushing for Wasm to get more performant code out of their browser.
Comments