Check out a free preview of the full Web Assembly (Wasm) course
The "Wrapping Up" Lesson is part of the full, Web Assembly (Wasm) course featured in this preview video. Here's what you'd learn in this lesson:
Jem concludes the course by sharing some resources and example applications that use Web Assembly. Questions about file watchers and supported programming languages are also answered in this segment.
Transcript from the "Wrapping Up" Lesson
[00:00:00]
>> We are there we're done, we've spent an entire day writing low level code and understanding [LAUGH] unsigned eight bit integers and all that fun stuff. I wrote all this in markdown in VS Code so that that means I essentially have no grammar and spell check, so there are probably plenty of spelling errors.
[00:00:21]
If you see any, please follow this you are open a pull request, I really appreciate that if you want to start to make it more available for other people, I appreciate that as well. There are some further resources, WASI is increasingly becoming very popular, WASI is essentially an API into the file system.
[00:00:42]
So right now if I wanted to read files from web assembly, I'd have to load those into memory convert those and do all that. That unfun byte conversion, reading the buffers and pointers and all that, WASI Its goal is to provide an a standardized API that works on any files or works on any operating system.
[00:01:01]
And you can do things like reading a file and doing all the low level desktop operations that we've come to know and love, but we can do it in web assembly. That's the goal of WASI, I expect you'll hear a lot more about this in the future. So if you want to stay ahead of the curve, this is we'll say the new hotness and web assembly it's not that new but it's new enough.
[00:01:23]
There's made with web assembly if you wanna see what people have done so far. And if you wanna look at some of the source code, and you'll see what I mean when I say web assembly gets very, very complicated very quickly. Here's a collection of resources I believe, I think actually, Amy you shared this with me who is in the chat, or somebody shared this with me I appreciate whoever sends me these links.
[00:01:46]
Figma is probably one of the bigger cases that modern front end engineers know about. They're using baby wrote their entire front ends to use web assembly which is pretty cool. They're probably one of the bigger users or most well known right now. I remember how we had to do that kind of ugliness with underscore get string to get a pointer to get a string out of the web assembly, as bind I aims to fix that problem, so you don't have to use the loader.
[00:02:16]
You can pass data structures like objects and arrays and strings back and forth between web assembly and JavaScript. It does all of that work for you without having to get into that low level mess with pointers. So as mine is a pretty cool library pretty useful as well and it's still being updated, I won't go through all these binary and is the compiler and tool chain.
[00:02:39]
That is how Literally all the web assembly we know from JavaScript to rust and all that gets built into web assembly. The one you've probably heard of or may have heard of is Emscripten, that is the compiler tool chain that c and rust in all those use to convert from those languages into another assembly.
[00:02:59]
It uses under the hood binary and on top of that, so it just you will hear if you get into web assembly you'll definitely hear of Emscripten it's extremely popular. It's fairly mature right now, and the people I work on are just pretty, pretty awesome, I'll skip build with web assembly or our build assembly scripts.
[00:03:19]
Actually, we can look at it real quick, this is on this assembly script.org. It's a bunch of things built with assembly scripts, just to show you what you can do web assembly studio that thing, the editor we just use was built in assembly scripts. That's, it's pretty cool, but these are examples of things you can do anything is possible, in fact, I consider this a pretty short list.
[00:03:46]
I think, there are a lot more powerful features or powerful applications that, just haven't been build yet, people just haven't bothered to do it. And the last one, I wanted to point out, there is an epilepsy warning around this cuz it's [SOUND] it will flash. But the reason why I stayed away from more complicated use cases of assembly script is because, well, it gets it gets nigh unreadable, remember we talked about bitwise operations?.
[00:04:18]
Yeah, we do, you do a lot of those, so I tried to stay away from Things like this but if you if you wanna see what it looks like what a real application doing real work. In this case it is gonna think like a flashing pretty cool image, it's this is all written in assembly script and compiled to web assembly.
[00:04:41]
I'm not quite sure what it does, it's kind cool, kind of just kind of move with it, I, but you can look at the source code here and see exactly what it means to write to memory to do bit manipulation, things like that. We stayed away from that cuz again, it's too complicated but You can dive as deep as you want in web assembly.
[00:05:02]
Or you can stick at a higher level with assembly scripts and just just to create content.
>> Is there a watcher for that assembly script build process?
>> There is I don't think it's built into assembly script, It might be somewhere in the tooling that I haven't discovered but there are watchers for node, actually no just look this up, node like node watcher no.
[00:05:34]
Yeah, I think actually will node mon do it.
>> So no mine would take care of that and as you change your.
>> Yeah, any sort of watcher that watches the file system for changes and then executes whatever command you want would work.
>> Okay.
>> That's a good point.
[00:05:50]
>> So it doesn't matter that it's the AS build process?
>> Doesn't matter.
>> Okay, cool.
>> Good question though, one of the questions was if you were to create a new WASI projects, what is the the language you would choose. If I'm understanding correctly, and that's totally dependent on what you're most comfortable with.
[00:06:10]
And generally we're writing assembly script because I'm most comfortable in JavaScript. If you are a C programmer or rust programmer, I would write in C or rust, those are going to be a bit more powerful languages and they're a bit more mature. When it comes to the platform so you can do more things, I guess one of the differences and one of the issues with writing in Rust and C versus assembly Script is, we saw that without including that run time, we can actually get really, small WASI files that are easy to digest and read.
[00:06:40]
However, when you write in C or Rust, because they're not native JavaScript, they include a lot of boilerplate Glue Code that can make the WOT files a little bit harder to digest. And the files they send down the pipe for, like even a really simple example, tend to be quite large.
[00:06:57]
Whereas assembly script, we can actually get that down pretty minimal. So, that long answer to which language would you use if starting new Web assembly project it's, I would use whatever language you're comfortable with. And that is supported by web assembly, let's see if they have a list of languages that are supported.
[00:07:15]
Yeah, there we go, good old open source. So, apparently all these languages are relatively well supported for writing web assembly. Dot net who knew, the, go, we're interesting so, write PHP not quite there yet. So essentially, you can, according to this, you can use a lot of languages so you kind of have whatever you want to choose, I assume you're probably gonna know at least one of these languages.
[00:07:57]
You know what I thought Java was better supported, it's interesting I think that's it. There's a special thanks to Bryan Holt, he actually created a course startup kit, so if you have a course you wanna create, he has a course starter on GitHub that you just clone, and you can create all of your course and markdown and use that.
[00:08:17]
My friend Justine, and Luna, they helped me with the site design to make this a little bit prettier for you all. Because before it's like this narrow amount of space, garbage, and of course the entire team in front of masters. We literally spent four hours yesterday getting the entire studio set up they're awesome, they've made it really painless.
[00:08:38]
And of course Special thanks my wife and son who they put up with me, I don't know why but I love them dearly. And with that, thank you for taking the course, reach out to me on twitter if this helps. If you have suggestions, again, file a PR if you see something missing or there should be a note or agenda I should add into the content but if not, go forth and build, thanks.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops