Programming WebAssembly with Zig - Getting Started with the ZIG programming language

Ғылым және технология

In this ZigLang Tutorial, chris shows you how to get started with the ZIG programming language and WebAssembly. he shows that zig can not only be used to create native applications but also webassembly applications and libraries that can be run in browser or server-side.
Not only do we look at how to create zig applications in webassembly, we also look at the WASM it generates and give an understanding of how it works
00:00 - introduction
01:20 - installing ZIG
01:57 - hello world
04:00 - super fast ZIG compilation
04:35 - creating a math library
08:08 - compiling our ZIG math library in webassembly
10:35 - executing our wasm library in node.js
15:00 - converting our webassembly from wasm to wat
17:48 - analyzing our dissassembled webassembly in WAT (webassembly text format)
28:34 - using WASI, WASM and WASMER to run our ZIG WASM independently
31:00 - conclusion

Пікірлер: 43

  • @AbdulmalikHamid
    @AbdulmalikHamid Жыл бұрын

    This channel in my opinion is the number one goto channel for anyone in computer science. Great job boss.

  • @chrishayuk

    @chrishayuk

    Жыл бұрын

    too kind.. i see this channel as my tech therapy, but glad it's more useful than that

  • @user-rh5km2fy7b
    @user-rh5km2fy7b Жыл бұрын

    Thanks to you, I have found that amazing Zig language. What a fresh air it is in the world of programming. Its insane

  • @chrishayuk

    @chrishayuk

    Жыл бұрын

    Amazing! glad you're liking it

  • @amanueltigistu8268
    @amanueltigistu8268 Жыл бұрын

    Thanks for your great content. Please create more tutorials on Zig. I think Zig is an impressive & fun language to work with & also Zig is just a Unique & familiar language with Great Features built-in. I really like the simplicity of Zig as I am mainly a Typescript Developer.

  • @chrishayuk

    @chrishayuk

    Жыл бұрын

    agree, really nice language, more to come. and totally agree on the familiarity and fun point

  • @dazealex
    @dazealex Жыл бұрын

    Very cool content, loving the coverage on Zig!

  • @chrishayuk

    @chrishayuk

    Жыл бұрын

    More to come!

  • @sifundomhlungu5119
    @sifundomhlungu5119 Жыл бұрын

    Amazing def subbing, started Zig yesterday, absolute beauty of a language can't wait for more!🤩

  • @chrishayuk

    @chrishayuk

    Жыл бұрын

    thank you, glad it's useful. zig is such fun

  • @anesaithammou696
    @anesaithammou696 Жыл бұрын

    For any one facing issues with the compilation. use -rdynamic flag in addition to -dynamic.

  • @gldev8191
    @gldev8191 Жыл бұрын

    I was never interested in programming langauges themselves before i discovered Zig, loved it thank you for covering it!

  • @ricardorosa5315
    @ricardorosa5315 Жыл бұрын

    This is so damn great!!! You explain really really well...!!!

  • @chrishayuk

    @chrishayuk

    Жыл бұрын

    Thank you 😊

  • @guilherme5094
    @guilherme5094 Жыл бұрын

    Really nice👍

  • @chrishayuk

    @chrishayuk

    Жыл бұрын

    thank you

  • @eddyflux
    @eddyflux6 ай бұрын

    for anyone wondering why the "add" function is not exported: you have to now write "export" before your add function + run the build with -rdynamic

  • @_realist_6957
    @_realist_6957 Жыл бұрын

    💥💥💥

  • @chrishayuk

    @chrishayuk

    Жыл бұрын

    thank you

  • @Im_Ninooo
    @Im_Ninooo11 ай бұрын

    coming from Go, Zig felt a bit slow to compile but compared to Rust it's super fast!

  • @Diamonddrake
    @Diamonddrake11 ай бұрын

    Please turn off copilot while filming videos, it’s very distracting. Neat overlay effect, I’ve never seen that in a coding video.

  • @CallousCoder
    @CallousCoder Жыл бұрын

    I had never seen web assembly before but when I saw that awful code I immediately had a flash back to writing some Forth way back in 1993. And as an old assembly and C person it was really hard to think that way. Hilarious how these hold tried and proven concepts slowly come back in the terrible world of web development. Maybe there is hope. At least of lowlevel system side we have new good solids options emerging, like Rust (after a year I finally start to feel a bit as native speaker and not fighting the borrow checker as much) and since yesterday I did some Zig coding, simple stuff like creating X threads and X array lists and filling those and merging the result. Some of my default coding on a new language. And that was not a fun experience in my first try on rust 4 years ago. But with Zig it was like: “yeah! I love this! It’s still young not a lot of external libraries but this will be the new C and Rust the new C++). And my goodness it’s fast! Both in compiling and runtime. The very small std is brilliant for creating small binaries. Just a thrill to use!

  • @kyonas6047

    @kyonas6047

    Жыл бұрын

    My BIGGEST feature is.. You can program with a language like zig just by using 1 small zip folder.. Like on windows you have to get other compilers like msvc which is like 10GB for my laptop that has bad storage its litterally 3rd of my storage but with zig its only 100mb and you can do some insane stuff with it I wanna experiment with doing a front end framework with deno and zig it seems fun or doing a progressive web app that runs offline and uses zig webassembly sounds like a cool learning experience fr

  • @PeteC62
    @PeteC62 Жыл бұрын

    It’s hilarious that you said we don’t write WASM by hand because languages like zig can write it so much better, given how appalling the generated code was. It’s too bad you didn’t try compiling it with whatever optimization options zig gives you. You could write your function using zero locals just by leaving intermediate values on the stack.

  • @bonniesimon14
    @bonniesimon1410 ай бұрын

    Hey loved the video. Had a few suggestions on parts you could improve: 1. Turn off the code assistant. It is really annoying to see that because it distracts the viewer away from what you are saying. 2. Get the green light off your face. Take that yellowish/skintonish light and maybe use that on your face instead.

  • @chrishayuk

    @chrishayuk

    10 ай бұрын

    Really good suggestions. I now check copilot is off before record. I do like playing with the colors though

  • @ahmadumar6210
    @ahmadumar6210 Жыл бұрын

    And secondly, do you think the Performance of ZIG is comparable with that of rust?

  • @AlexanderSuraphel

    @AlexanderSuraphel

    Жыл бұрын

    All languages compiled directly to the machine should have very similar performance. Most of the optimization is done by the compiler. Plus Zig and Rust both compile to LLVM which creator of Zig created.

  • @ahmadumar6210

    @ahmadumar6210

    Жыл бұрын

    Thanks this info is important

  • @AlexanderSuraphel

    @AlexanderSuraphel

    Жыл бұрын

    @Chris M thanks for pointing it out. Don’t know how mixed him with Chris Lattner.

  • @chrishayuk

    @chrishayuk

    Жыл бұрын

    yes but rust is more focused on safety

  • @StarsManny

    @StarsManny

    Жыл бұрын

    ​​@@AlexanderSuraphel do all languages compiled to the machine have a similar performance to C?

  • @avi7278
    @avi7278 Жыл бұрын

    What's weird thing did you say about Adele albums?

  • @chrishayuk

    @chrishayuk

    Жыл бұрын

    Lol, no idea, can’t remember but I’m sure it’d be some numbering thing

  • @GLiBERN

    @GLiBERN

    9 ай бұрын

    "19", "21", "25" used as example numbers here are the titles of Adele albums.

  • @4sat564
    @4sat564 Жыл бұрын

    Does anybody like the transparency effects in Chris videos? I find it very hard to watch

  • @nathanfranck5822

    @nathanfranck5822

    Жыл бұрын

    Yeah I think a subtle blur on the background would go a long way in seperating the code characters from the background noise

  • @chrishayuk

    @chrishayuk

    Жыл бұрын

    ooh quite a good idea on the blur, i try and darken for certain code elements. hopefully i achieved it better on this weeks vid, but love the blur idea, will try it

  • @_thehunter_
    @_thehunter_ Жыл бұрын

    zig syntax is ugly.. ugly in sense its very cryptic once complexity kicks in

  • @ahmadumar6210
    @ahmadumar6210 Жыл бұрын

    Thanks for your stuff, Do you have a discord server?

  • @chrishayuk

    @chrishayuk

    Жыл бұрын

    ah no, sorry, probs not a direction i'll go

  • @illegalsmirf
    @illegalsmirf Жыл бұрын

    Import STD? Better see your doctor!

  • @chrishayuk

    @chrishayuk

    Жыл бұрын

    Hahaha yeah

Келесі