Looking for books & other references mentioned in this video? Check out the video description for all the links! Want early access to videos & exclusive perks? Join our channel membership today: ua-cam.com/channels/s_tLP3AiwYKwdUHpltJPuA.htmljoin Question for you: What’s your biggest takeaway from this video? Let us know in the comments! ⬇
12:38 I needed a C compiler on Windows for a Neovim plugin. The Zig compiler was, by far, the easiest way to get a C compiler compared to Mingw, Clang, MSVC, or GCC. Awesome stuff!
Mingw wasn't too bad but everything didn't "just work" and that's never a good thing. At the end of the day, though, simply setting environment variables isn't a big ask.
9:01 GCC: stuck in past; stupid defaults; zig: optimizations by default 16:58 to interop; export C ABI using extern via wrapper functions 36:51 Reflections 39:31 Unit Testing (mem-leak eg) 42:12 contexts (void*, but better) 44:13 C integration DSA parts: 34:43 ArrayList 37:34 AutoArrayHashMap (ordered dicts) 39:59 MultiArrayList 40:36 Struct of Arrays
I can't believe how much the low level tooling and infrastructure for programming languages has improved. It's astounding! Makes me absolutely love open source even more than I did before because this makes low level more accessible to more developers.
I tried it out the other day and I thought it was really cool. I just messed around with it and converted some of my C programs into Zig code and it was really easy to pick up and ran with great performance. The drop in c++ compiler is so useful. I never had a convenient way to compile for MacOS before, very helpful stuff.
I never knew i could get a c compiler for less than 100mb iam probably dumb cuz i thought the only way to compile c is using msvc cuz gcc on windows isn't great
Blown away by that example of the Zstandard library which had multiple makefiles while all that was needed was to pass a list of filenames to the compiler 😮
He sailed right through it in the talk, but what amazed me was that the optimizer in the Zig + C array_sum example applied one optimization across the language boundary, ...and back again!! 🤯 BRB, going to try Zig!
@@DouglasDickinson LTO / LTCG gives you that. The language front-ends produce a common intermediate language representation. Global optimizations are applied when all this IL form is available and being linked together. Once optimized, machine code generation happens.
I remember when Andrew presented out Recourse. Now he presented at GOTO. Wow, Zig has come far. Congrats to everyone involved in the project, and thank you to each sponsor. e: fwiw, I saw the Recourse video on UA-cam :) it's still worth a watch
Anyone here after Zig won the ''fastest programming language' challenge at Dave's Garage? LOL That's why I'm here. Maybe Zig is worth paying attention to... >_
Yup. Although some of the comments suggest the zig solution uses subtly "cheating" flags to game things a little. Still an outstanding result, and it looks like there's plenty of interest other than raw performance.
@@robbybobbyhobbies I mean yeah though it doesn't actually beat Rust's performance (Rust was actually the top winner if you don't measure per seconds per threads but measure per seconds only), it still is a pretty interesting language. Its metaprogramming and reflection capabilities leave Rust in the dust, and I'm saying this as a hardcore fan of Rust.
listening to this makes me feel like the first time i fell in love. Super excited and scared and not knowing enough but loving every moment of it. Thank you ! You inspire.
last week i tried porting a c library with 11 files to zig, i finished it in 4 days, take in mind i never wrote zig before that in my life the language is elegant and forces you to do the proper thing, i spent the first day fighting with Zig Language Server crashing, and fighting the compiler not liking my code, eventually i started to comprehend why zig is made this way, it will make you a good programmer, there's no handholding, or nice abstractions that do stuff for you, it will force you to make explicit clear code I think zig is the first proper programming language, it's like if C was designed with 50 years of programming history in mind, it's the first language that enables you to create a non failing deterministic code, this is the king of creating mission critical software i think computer science classes should adopt zig as the first programming language to teach to students
@@Олег-ю3щ4ъ I don’t think they really compare, golang isn’t particularly good for mission critical stuff because the mark and sweep makes go non deterministic, it’s great language for some business logic and CRUD but it’s NOT systems programming language like zig.
@@Олег-ю3щ4ъ golang is garbage collected so it cant be used in many mission critical single threaded applications, plus from the learning perspective, you dont learn memory management if you never free. Go is great for some stuff though, to be sure.
Totally agree, what really stands out to me is how the language, is really just C but with all the most common unsafe/error prone patterns from C corrected. No need to use goto : Cleanup, because now you have defer/errdefer. No need to use void* or Macro for generics, you can use comptime. No need to worry about shadowing of variables because the compiler won't let you do it by accident, no need to keep in mind the awful implicit conversion rules of integers, no need to worry about #define statements modifying the function you are calling, no need to man a function to know if it returns (0,-1 set errno, does nothing, return null) on errors. No need to worry about using a function that doesn't exist or doesn't behave the same way on another platform. Compile time evaluation instead of terrible #ifndef #elif #define, I mean there is so much to say about the language, I'm still forced to use C at work, but I can't wait to be able to use Zig.
RAD Game tools were amazing back in like 1998. Their video codec (with their encoder and decoder built in asm) is insanely good. All of the GOOD FMV sequences back in the 1990s were thanks to RAD Gaming tools.
@@ITSecNEO You can make one big unsafe block then. The reason this even exists is because separating out undefined behavior allows you to focus your debugging efforts.
i'll be honest, i love the simplicity of zig. Even C is less transparent than what Zig is doing. Which is an insane feat. Another thing i love are the integer types. I dont have to fiddle with bits to get an u24, or heck: even an u23.
Using something like u24 or u23 will be a big and slow mess under the hood. There is a reason, why C doesn't support it. Look at the assembly code and learn something about typical CPU architectures like the x86.
@@Mempler What high-level languages have in common is that they must be suitable for all possible CPU architectures. That's why they abstract very strongly at the byte level and not at the bit level. So they only support the common denominator. If you want to get even closer to the hardware, then you have to rely on assembly language or come up with some kind of crutch solution in high-level language.
This isn't true at all or at least not for me. The Rust compiler is generous enough to give a better error explanation than any other compiler I have ever seen. And when you're comparing w/ Zig compiler...oh boy, it's not feasible and can generate worse errors than a generic C compiler does.
Here's my take: Both Rust and Zig are C alternatives. Rust is willing to sacrifice C interoperability for memory and thread safety. Zig is willing to sacrifice memory and thread safety for C interoperability. That's not to say that Rust is completely incompatible with C nor that Zig is completely unsafe. It looks like Zig elects to warn you when code could be unsafe, whilst Rust elects to forbid code that could be unsafe.
Rust is a C++ alternative, not really a C alternative. Its philosphy is also similar to C++ in its patterns and kitchen sink mentality. Zig is also a C++ alternative, but also a C alternative. It essentially tries to take the best of C++, whittle away the cruft, and give a syntax that is close to as simple as C is. It's complexity level is somewhere in the middle, which is fine, considering what it acomplishes.
@@NdxtremePro Rust _is_ a C alternative. The Linux project is trying out Rust alongside C, which should be a strong argument. The way Zig and Rust differs immensly is that Zig has a focus on simplicity while Rust sacrifies simplicity for static analysis as strong as possible. They can both interop with C but Zig's C interopability has extremely high priority and is superb.
Rust has not sacrificed C interoperability in any way. It has been a primary goal from its inception, because Mozilla had a huge repository of C++ code that they wanted to embed Rust into. Rust has repr(C), extern "C", CString/CStr, and much more for seamless interop. You can easily generate Rust bindings for C libraries, and export Rust functions for use in C code. Reminder that you can only use Zig "seamlessly" if you use the Zig toolchain to compile all of your code. If you don't, it's just as much effort as using Rust, but you give up all the other benefits using Rust has.
@@NdxtremeProzig 100% seems like a better choice than c++. For replacing C however i am quite skeptical. It seems great for game dev though (maybe once the tools get fuether along that is)
Zig made me get off my ass and start writing backends for retro microprocessors using it :) Zig feels like compile-time Python. When you do say function decoration in Python, it’s all executed each time you load the module. It is an easy way to express stuff but expensive in a data center. Zig lets you code in a very similar style. It just does all the code transformations using your algorithms during compilation. It is doing right now what Fast Python initiative will have to do sooner or later.
Guys, I'm no system programmer. Everything he says sounds amazing. A system language that can be used as a build system. Shouldn't it generate more hype?
It's pre 1.0 so there are still breaking changes. It isn't ready for production. It needs more documentation and tutorials. The package manager is super new and still a work in progress. Rust already has a ton of love, but zig may really pick up steam once it matures a bit.
I am hyped for Zig, but I don't think it's quite production-ready yet; I want to see more development before I start considering it for more of my projects.
@@hansdampf2284 I never thought I'd hear "Rust does that for Rust" and understand that statement completely and have it make sense in my head, but the year is 2023.
30:53 "Jim from DeanEgg from Vancouver about Mesh rendering using zig" I searched with this name, and no results showed up on yt. It's 2024-Q1 now. I don't think the talk is up yet.
I literally need a zig repo, because reinventing the wheel of libraries and converting code? Zig right now is just a consumer of C code. Super fast, but I need to develop with more than the standard library. GUI framework? TLS library? sqlite, sql, http, anything higher level than carving a wood stick again. It can be the most badass language that never was unless api/framework devs grab on to it and say hey, let's ditch C/C++.
For some reason I found it hard to take Zig seriously due to the name. I thought only C and Rust were the real options. Zig has some serious potential it looks like.
Your comment about Rust was hilarious (things taking 4x longer to develop, using Rust). Tried learning Rust some months ago. Had numerous WTF moments where I knew exactly what I wanted, but Rust wouldn't compile the code, due to my not having tracked mem allocation properly. Gave up on Rust when I realized that Rust was like a programming straitjacket and programming in Rust was not fun or interesting..
Funny you say that. Andrew went from C++ to Rust to C-like C++ with templates to make generics before writing Zig. Zig is supposed to replace C, not C++. This is why it is a simple language
I've never had a problem installing MS Visual Studio. It only takes a few minutes, and I've used most versions since v4.0. This sounds like a strawman. By contrast, I have had a lot of problems installing other IDEs and setting up build environments for non MS languages, e.g., Java and rust and other IDEs such as Eclipse and VSCode.
16:58 > _"now, this is using a slice; which ain't c concept. so, export a C ABI [via] wrapper function"_ ohwww ohkayh. got it now. that's how it interops with c, and that's the functioning of externs. got it.
Why "unfortunately"? It was pretty much "either Rust or C forever". Its not likely for Linux to consider language before its been around for a decade. If anything, Rust broke the ice for future languages likr ZIG.
Zig is already very popular and loved, I have no doubt that it will make a very good argument for itself once it becomes stable. Unfortunately that's going to take a few more years. We can't even be sure of the extent of Rust's support in Linux with how (rightly) cautiously Linus and the others are treating it. There's no guarantee it will remain there at all.
@@charliegnu zig is not stable yet - async straight up doesn't work with current trunk for example. It's fun to play around with, and while I wouldn't recommend building a commercial project with it right now sure you can do that. It's absolutely not even close to being to the point where any reasonable person should be comfortable putting it into Linux, which is a significant part of the foundation of the tech world. It'd be like building your house on a foundation made of some new material that has some promising properties but little use outside of labs and with 0 durability tests. It just doesn't make sense.
@@gavinvales8928 Wikipedia even claims that Windows 3.1 is just a graphical interface for DOS. That's not even true. Strictly speaking, it is an operating system that uses DOS as a bootloader. Source: Raymond Chen. The Wikipedia article is therefore incorrect.
I share many of the views of Andrew Kelley. But I do think the view of all for-profit company is evil is a little too extreme and naïve. I don't think the blame is only on the buyer but also the seller. For example, if fit-bit never had to sell, they could still keep the data "safe." I don't think Google put a gun on their heads and said you must sell to us. The way I'd like to look at is "is the world a better place when we have ___" and in the case of Google, I actually do think the world is a better place in 2023 with Google than what the world would have been if Google never happened in 1998 at least imho. Yes, Google is not as "unevil" as it was before but then world changes and sometimes you have to survive to maybe do some good in the world. For example, I recall how evil MIcrosoft was but hey it brought us Visual Studio Code and Terminal for free. :) Anyways, I totally share the view on OpenAI though. :)
Why are you using the massive LLVM Libraries for Zig? An LLVM-only build requires anywhere from 1 to 3 GB of space on a machine. A full build of LLVM and Clang will need around 15 to 20 GB of disk space. The exact space requirements will vary by system but damn. They claim it's so large because of all the debugging information and the fact that the libraries are statically linked into multiple tools. No Offence, however just before using Zig for your own Application Builds, your using a Program larger than a Linux Ubuntu OS just to achieve it. You would be much better off to have gone with a Python Like Approach using C++ as a base language with an Interpreter instead right?
LLVM does not really compare to python, yeah small interpreter will be small but it’s still just an interpreter, LLVM basically gives you state of the art AST and amazing multi platform codegen, with all the micro optimizations you can dream of. You can’t really use python-like interpreter for mission critical stuff because it’s slow and non deterministic and ultimately forces you to include the entire runtime with your application to even run it.
When C++ was created it was compiled with cfront---a precompiler for the C language. You give your C++ code to cfront and it outputs a C program which can then be compiled with the available C compilers at the time. Because of this, C++ was gradually introduced to the C developers community. If a C developer wants to use a C++ feature not present in the C language, he would simple write that routine in C++, have it compiled to C, and immediately use it without breaking a sweat. There is no compulsion for the C developer to move their entire toolset to C++. Nor do they have to worry about C++ zealots calling his language, C, obsolete, buggy, and filled with arcane pointer arithmetic. Hah! I am glad to see that Zig is following in the same footsteps as C++. Compare C++ and Zig's attitude with that of Rust where the Rust community, without any provocation, is bent on antagonizing the entire C++ community by not even trying to cater to the needs of veteran programmers. They are so full of their own hot air, they keep on harping about the superiority of their language and how much faster and cleaner it is, that they are antagonizing the very community that they are trying to attract. I'm sorry. I don't have any need for a borrow checker or pointer-less code because I have made peace with memory allocation and pointer operations in C and C++. Rust has to offer me more than their borrow checker or whatever thingy they have before I make the leap from C++ to Rust. I will not spend three or six months of my time, learning to use Rust and getting acquainted with its tools, quirks, and libraries, when in those very same six months there are tons of new technologies that I have to keep up with (eg CUDA, AI, WebAssembly containers, etc.) while also building software in the language appropriate for the project, be it C, C++, Python, WebAssembly, Bash, or even Java. I therefore applaud Zig for doing the right thing by not forcing the veteran and professional programmers to discard their toolset, their procedures, their standards, their libraries, and all their other hard earned expertise just so they can be cool to newbie programmers. Python and Javascript did not win the language wars by antagonizing the C and C++ communities. Python and Javascript won because they offered something that C and C++ does not have: ability to work on the browser (in the case of Javascript) and good memory management, dynamic typing, and the REPL in the case of Python.
You wrote: "I don't have any need for a borrow checker or pointer-less code because I have made peace with memory allocation and pointer operations in C and C++. Rust has to offer me more than their borrow checker or whatever thingy they have before I make the leap from C++ to Rust." The problem you don't seem to see is that the industry will simply replace you with younger programmers who are willing to code in Rust.
@@OpenGL4ever Maybe? Maybe not? The problem with Rustaceans like you is that you still live in the 1980's when memory buffer overflows were still common. It is not as common now, kid. There are more hacks involving social engineering and surreptitious backdoors (have you heard of the xz backdoor put in, possibly by a state actor?) than buffer overflow vulnerabilities. The world has learned. The problem with buffer overflow is a problem with the C language and not with C++. It is possible to write C++ code without malloc, fgets, and those other things that you people keep harping on about if one is willing to forego C compatibility. It's like your knowledge of programming ended in the 1980's. Yet, despite your fears, the Linux kernel is written in "unsafe" C and yet it is one of the most secure kernels around. For your education, learn that a computer language is only part of a development system. What is equally important is the environment, the tools, the libraries, the institutional experience, and the decades of testing and use of the dev system. Rust isn't there yet. Grow up. Your language is still in the hobbyist stage. Come back and take my job when Rust has become de riguer in AI, Game Engine, machine learning, and low latency programming. A Rust fanatic may have convinced you to concentrate on Rust because it is "the language of the future." That may be so. But, kid, I hate to tell this to you, but until that actual future arrives, you and Rust will just live in unemployment land because you refuse to learn what is needed now instead of what is needed in the future. Who knows? Maybe in the future AI will do all our programming so Rust and human programmers won't even be needed.
The guy is showing one fault of the American system. I refer to people willing to sell their business in order to bring their kids to college. That’s only an American thing. Education should be free or at least affordable
Looking for books & other references mentioned in this video?
Check out the video description for all the links!
Want early access to videos & exclusive perks?
Join our channel membership today: ua-cam.com/channels/s_tLP3AiwYKwdUHpltJPuA.htmljoin
Question for you: What’s your biggest takeaway from this video? Let us know in the comments! ⬇
12:38 I needed a C compiler on Windows for a Neovim plugin. The Zig compiler was, by far, the easiest way to get a C compiler compared to Mingw, Clang, MSVC, or GCC. Awesome stuff!
Huh that’s interesting. I’m gonna have to try this because I’m not very happy with my current windows c compiler (I think mingw)
Mingw wasn't too bad but everything didn't "just work" and that's never a good thing. At the end of the day, though, simply setting environment variables isn't a big ask.
bruh.. should have went with MSYS2. is so simperu! u just have to start it and `pacman -S mingw-w64-ucrt-x86_64-gcc` i use arch btw
9:01 GCC: stuck in past; stupid defaults; zig: optimizations by default
16:58 to interop; export C ABI using extern via wrapper functions
36:51 Reflections
39:31 Unit Testing (mem-leak eg)
42:12 contexts (void*, but better)
44:13 C integration
DSA parts:
34:43 ArrayList
37:34 AutoArrayHashMap (ordered dicts)
39:59 MultiArrayList
40:36 Struct of Arrays
this talk from Andrew is a gem, thanks GOTO for sharing!
I can't believe how much the low level tooling and infrastructure for programming languages has improved. It's astounding! Makes me absolutely love open source even more than I did before because this makes low level more accessible to more developers.
open source rules the world.
butt can you gett to the lowestt levels with open sauce?
I tried it out the other day and I thought it was really cool. I just messed around with it and converted some of my C programs into Zig code and it was really easy to pick up and ran with great performance. The drop in c++ compiler is so useful. I never had a convenient way to compile for MacOS before, very helpful stuff.
I never knew i could get a c compiler for less than 100mb iam probably dumb cuz i thought the only way to compile c is using msvc cuz gcc on windows isn't great
zig community is really refreshing
Blown away by that example of the Zstandard library which had multiple makefiles while all that was needed was to pass a list of filenames to the compiler 😮
I was secretly surprised when he said “that’s all I’ve got for you”.
He sailed right through it in the talk, but what amazed me was that the optimizer in the Zig + C array_sum example applied one optimization across the language boundary, ...and back again!!
🤯
BRB, going to try Zig!
@@DouglasDickinson LTO / LTCG gives you that. The language front-ends produce a common intermediate language representation. Global optimizations are applied when all this IL form is available and being linked together. Once optimized, machine code generation happens.
"appease the borrow checker with a worthy sacrifice". LMAO 🤣
I remember when Andrew presented out Recourse. Now he presented at GOTO. Wow, Zig has come far. Congrats to everyone involved in the project, and thank you to each sponsor.
e: fwiw, I saw the Recourse video on UA-cam :) it's still worth a watch
I'm so glad nobody knew off the bat what 20 in hex is. It makes me feel better about myself.
What a great guy! I've been eyeing zig for a few years now, this made me want to finally jump right in!
Anyone here after Zig won the ''fastest programming language' challenge at Dave's Garage? LOL That's why I'm here. Maybe Zig is worth paying attention to... >_
Yup. Although some of the comments suggest the zig solution uses subtly "cheating" flags to game things a little. Still an outstanding result, and it looks like there's plenty of interest other than raw performance.
@@robbybobbyhobbies I mean yeah though it doesn't actually beat Rust's performance (Rust was actually the top winner if you don't measure per seconds per threads but measure per seconds only), it still is a pretty interesting language. Its metaprogramming and reflection capabilities leave Rust in the dust, and I'm saying this as a hardcore fan of Rust.
Ditto!
After that challenge I really want to test zig and rust
sus metrics from dave imo. Should've run non-parallel as the 'main' metric. Zig does look cool though
Wow I didn't know that Zig to C interoperability was so great! I really enjoyed the ease of consuming C libraries from Zig.
yeah spr ezy. i dip mine in milks and consum thm like cookies
Looks interesting & refreshing. Well, syntax sure needs getting used to.
listening to this makes me feel like the first time i fell in love. Super excited and scared and not knowing enough but loving every moment of it. Thank you ! You inspire.
last week i tried porting a c library with 11 files to zig, i finished it in 4 days, take in mind i never wrote zig before that in my life
the language is elegant and forces you to do the proper thing, i spent the first day fighting with Zig Language Server crashing, and fighting the compiler not liking my code, eventually i started to comprehend why zig is made this way, it will make you a good programmer, there's no handholding, or nice abstractions that do stuff for you, it will force you to make explicit clear code
I think zig is the first proper programming language, it's like if C was designed with 50 years of programming history in mind, it's the first language that enables you to create a non failing deterministic code, this is the king of creating mission critical software
i think computer science classes should adopt zig as the first programming language to teach to students
Have you tried Golang?
@@Олег-ю3щ4ъ I don’t think they really compare, golang isn’t particularly good for mission critical stuff because the mark and sweep makes go non deterministic, it’s great language for some business logic and CRUD but it’s NOT systems programming language like zig.
@@Олег-ю3щ4ъ golang is garbage collected so it cant be used in many mission critical single threaded applications, plus from the learning perspective, you dont learn memory management if you never free. Go is great for some stuff though, to be sure.
Totally agree, what really stands out to me is how the language, is really just C but with all the most common unsafe/error prone patterns from C corrected. No need to use goto : Cleanup, because now you have defer/errdefer. No need to use void* or Macro for generics, you can use comptime. No need to worry about shadowing of variables because the compiler won't let you do it by accident, no need to keep in mind the awful implicit conversion rules of integers, no need to worry about #define statements modifying the function you are calling, no need to man a function to know if it returns (0,-1 set errno, does nothing, return null) on errors. No need to worry about using a function that doesn't exist or doesn't behave the same way on another platform. Compile time evaluation instead of terrible #ifndef #elif #define, I mean there is so much to say about the language, I'm still forced to use C at work, but I can't wait to be able to use Zig.
I wouldn't think too much about their question tbh. I saw in a few comment threads, it's the exact same comment in each thread, regardless of context.
great vision! we need such brilliant folks
Sounds like a promising language - nearly as a blend of the best from Go and Rust, melted into astonishing simplicity... wonderful! 👍
Seems pretty next level. The cross compilation is amazing
Have you tried Golang?
This presentation could easily make it to top ten Havard VC cases studies
RAD Game tools were amazing back in like 1998. Their video codec (with their encoder and decoder built in asm) is insanely good. All of the GOOD FMV sequences back in the 1990s were thanks to RAD Gaming tools.
Me thinking about the Warcraft 2 cutscenes.
Andrew is man of the century and Zig is the future.
This is interesting because last week rust was the future.
@@princeofpersiaize lol
last week rust was the future,remember?
Aah you changed idea,ok.
@@ITSecNEO Rust can be used for unsafe operations. You just have to explicitly declare unsafe blocks.
@@ITSecNEO You can make one big unsafe block then. The reason this even exists is because separating out undefined behavior allows you to focus your debugging efforts.
i'll be honest, i love the simplicity of zig. Even C is less transparent than what Zig is doing. Which is an insane feat.
Another thing i love are the integer types. I dont have to fiddle with bits to get an u24, or heck: even an u23.
Using something like u24 or u23 will be a big and slow mess under the hood. There is a reason, why C doesn't support it. Look at the assembly code and learn something about typical CPU architectures like the x86.
@OpenGL4ever But it certainly is great for low-level stuff.
@@Mempler What high-level languages have in common is that they must be suitable for all possible CPU architectures. That's why they abstract very strongly at the byte level and not at the bit level.
So they only support the common denominator. If you want to get even closer to the hardware, then you have to rely on assembly language or come up with some kind of crutch solution in high-level language.
@@OpenGL4everit's quite nice not having things like a char that COULD be a byte or a int that could be 64 bit could be 32 bit
In Zig, the compiler seems to work with the programmer, unlike in Rust where the programmer works for the compiler.😅
Oh that is so accurate!
I find that the Rust compiler is constantly telling me how to fix my program.
In rust, you play as the GC for your compiler
- some other commentor
I’m a big fan of the Rust compiler. It makes sure my code is highly correct
This isn't true at all or at least not for me. The Rust compiler is generous enough to give a better error explanation than any other compiler I have ever seen. And when you're comparing w/ Zig compiler...oh boy, it's not feasible and can generate worse errors than a generic C compiler does.
The secret surprise is quite literally secret
Here's my take: Both Rust and Zig are C alternatives. Rust is willing to sacrifice C interoperability for memory and thread safety. Zig is willing to sacrifice memory and thread safety for C interoperability.
That's not to say that Rust is completely incompatible with C nor that Zig is completely unsafe. It looks like Zig elects to warn you when code could be unsafe, whilst Rust elects to forbid code that could be unsafe.
Rust is a C++ alternative, not really a C alternative. Its philosphy is also similar to C++ in its patterns and kitchen sink mentality.
Zig is also a C++ alternative, but also a C alternative. It essentially tries to take the best of C++, whittle away the cruft, and give a syntax that is close to as simple as C is.
It's complexity level is somewhere in the middle, which is fine, considering what it acomplishes.
@@NdxtremePro Rust _is_ a C alternative. The Linux project is trying out Rust alongside C, which should be a strong argument.
The way Zig and Rust differs immensly is that Zig has a focus on simplicity while Rust sacrifies simplicity for static analysis as strong as possible. They can both interop with C but Zig's C interopability has extremely high priority and is superb.
Rust has not sacrificed C interoperability in any way. It has been a primary goal from its inception, because Mozilla had a huge repository of C++ code that they wanted to embed Rust into. Rust has repr(C), extern "C", CString/CStr, and much more for seamless interop. You can easily generate Rust bindings for C libraries, and export Rust functions for use in C code.
Reminder that you can only use Zig "seamlessly" if you use the Zig toolchain to compile all of your code. If you don't, it's just as much effort as using Rust, but you give up all the other benefits using Rust has.
Have you tried Golang?
@@NdxtremeProzig 100% seems like a better choice than c++. For replacing C however i am quite skeptical. It seems great for game dev though (maybe once the tools get fuether along that is)
Zig looks beautiful.
*I REALLY LIKE THIS GUY AND WANT TO TRY HIS STUFF*
Zig made me get off my ass and start writing backends for retro microprocessors using it :)
Zig feels like compile-time Python. When you do say function decoration in Python, it’s all executed each time you load the module. It is an easy way to express stuff but expensive in a data center. Zig lets you code in a very similar style. It just does all the code transformations using your algorithms during compilation. It is doing right now what Fast Python initiative will have to do sooner or later.
I'm sold
getCSourceFile vs get_c_source_file... I wish they didn't close the PR recently about making std library functions sneak_case :'(
nice presentation; believes in the work
Guys, I'm no system programmer. Everything he says sounds amazing. A system language that can be used as a build system. Shouldn't it generate more hype?
It's pre 1.0 so there are still breaking changes. It isn't ready for production. It needs more documentation and tutorials. The package manager is super new and still a work in progress. Rust already has a ton of love, but zig may really pick up steam once it matures a bit.
@@brianbrewer974 Yup, I definitely waiting to try deeper on zig until a stable release announced
I am hyped for Zig, but I don't think it's quite production-ready yet; I want to see more development before I start considering it for more of my projects.
Rust does that, too. Well, at least for rust
@@hansdampf2284 I never thought I'd hear "Rust does that for Rust" and understand that statement completely and have it make sense in my head, but the year is 2023.
28:45 a Vonn Neumann machine: a Von Neumann machine
30:53 "Jim from DeanEgg from Vancouver about Mesh rendering using zig"
I searched with this name, and no results showed up on yt. It's 2024-Q1 now. I don't think the talk is up yet.
Isn't the Rust Foundation a non-profit?
Yes
I literally need a zig repo, because reinventing the wheel of libraries and converting code? Zig right now is just a consumer of C code. Super fast, but I need to develop with more than the standard library. GUI framework? TLS library? sqlite, sql, http, anything higher level than carving a wood stick again. It can be the most badass language that never was unless api/framework devs grab on to it and say hey, let's ditch C/C++.
are the compiled binaries smaller or larger than go?
The video starts with the programming language related topics at 34:43.
For some reason I found it hard to take Zig seriously due to the name. I thought only C and Rust were the real options. Zig has some serious potential it looks like.
People said the same about Google.
Why didn’t you feel that way about Rust though 😅
In german zig means "an unknown but high amount" but I've never seen it used in english. Is it slang or does it just sound weird in english?
@@clang8649 Zig is a reference to the all your base are belong to us meme made from a poorly translated video game
@@jefffriedman6942 Thanks, makes sense
Thank you 👍
i like minimalist yet powerful
this is dope!
Nice talk Andrew... what about the secret surprise?
Yeah what was that
@@KManAbout secret!!
Your comment about Rust was hilarious (things taking 4x longer to develop, using Rust). Tried learning Rust some months ago. Had numerous WTF moments where I knew exactly what I wanted, but Rust wouldn't compile the code, due to my not having tracked mem allocation properly. Gave up on Rust when I realized that Rust was like a programming straitjacket and programming in Rust was not fun or interesting..
Yes... Skill isues..@@RustIsWinning
How best to approach this project to make a z80 code generator?
Zig rules!!!!!!
What's the concurrency story? I want to use Zig in place of Go...
Look at ponylang.
Andrew is genius
amazing
I am convinced by Zig and will comment out the Rust related plugins in Vim for now.
Can Zig parse tabs now?
Why did you call it a comptime param instead of a const param?
because something that's comptime has to be compile-time known, while something that's const just can't change after it gets its value.
The mentioned VFX Plugin talk: ua-cam.com/video/MhzWE2z4fjA/v-deo.html
So... what's the secret surprise?
von Neumann not Vonn Neumann ;)
MacOs open source ? Not sure about it, lots of part of it aren't open source minus the kernel and there's no such thing as half open source.
I wonder how much of this was inspired by Jai?
I love Zig, however, when it comes to stacktrace errors, I must admit Rust does it flawlessly.
@@ITSecNEO definitely giving them their space
We need a surrealdb type implementation from zig. I hope tigerbeetle team can do that work.
If you use it do you call yourself a Zigger? Is the hard R okay?
The Zig compiler comes with an implicit Z word pass, including the hard R.
zigma male
9:01 ohw, UBSAN = Undefined Behaviour Sanitizer. Capitalization UBSan would've increased its recognisability, but ohkayh.
The guy forgot to get back to the secret he promised in the beginning, IDK if I should trust him or what he does after this betrayal
C++ programmers discover modern programming practices
Funny you say that. Andrew went from C++ to Rust to C-like C++ with templates to make generics before writing Zig. Zig is supposed to replace C, not C++. This is why it is a simple language
Every time a new programming language appears saying it will replace another one, it does not.
It will take decades and legscy C/C++ will plauge the earth like COBOL or pearl for an eternity
I've never had a problem installing MS Visual Studio. It only takes a few minutes, and I've used most versions since v4.0. This sounds like a strawman. By contrast, I have had a lot of problems installing other IDEs and setting up build environments for non MS languages, e.g., Java and rust and other IDEs such as Eclipse and VSCode.
So Zig is kinda nix?!
❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤
16:58 > _"now, this is using a slice; which ain't c concept. so, export a C ABI [via] wrapper function"_
ohwww ohkayh. got it now. that's how it interops with c, and that's the functioning of externs. got it.
Unfortunately Linux is moving around Rust :(
Why "unfortunately"? It was pretty much "either Rust or C forever". Its not likely for Linux to consider language before its been around for a decade. If anything, Rust broke the ice for future languages likr ZIG.
Zig is already very popular and loved, I have no doubt that it will make a very good argument for itself once it becomes stable. Unfortunately that's going to take a few more years.
We can't even be sure of the extent of Rust's support in Linux with how (rightly) cautiously Linus and the others are treating it. There's no guarantee it will remain there at all.
Zig didn't even hit 1.0 yet though
Since Zig interops seamlessly with C, you could use it now to write kernel modules without having to "fix" the language like they had to do with rust.
@@charliegnu zig is not stable yet - async straight up doesn't work with current trunk for example. It's fun to play around with, and while I wouldn't recommend building a commercial project with it right now sure you can do that. It's absolutely not even close to being to the point where any reasonable person should be comfortable putting it into Linux, which is a significant part of the foundation of the tech world. It'd be like building your house on a foundation made of some new material that has some promising properties but little use outside of labs and with 0 durability tests. It just doesn't make sense.
I trust Wikipedia even less than Google these days.
yep. that was the worst example he could take for "non profit works". Wikipedia is evil for many many topics.
@@armynyus9123 like what?
@@gavinvales8928 like *any* topic, remotely political.
@@gavinvales8928 Wikipedia even claims that Windows 3.1 is just a graphical interface for DOS.
That's not even true. Strictly speaking, it is an operating system that uses DOS as a bootloader. Source: Raymond Chen. The Wikipedia article is therefore incorrect.
Me. Gusta
Sqlite will probably be bought by oracle, and forked by the community as "sqlibre" or "opensql" or something
I share many of the views of Andrew Kelley. But I do think the view of all for-profit company is evil is a little too extreme and naïve. I don't think the blame is only on the buyer but also the seller. For example, if fit-bit never had to sell, they could still keep the data "safe." I don't think Google put a gun on their heads and said you must sell to us. The way I'd like to look at is "is the world a better place when we have ___" and in the case of Google, I actually do think the world is a better place in 2023 with Google than what the world would have been if Google never happened in 1998 at least imho. Yes, Google is not as "unevil" as it was before but then world changes and sometimes you have to survive to maybe do some good in the world. For example, I recall how evil MIcrosoft was but hey it brought us Visual Studio Code and Terminal for free. :)
Anyways, I totally share the view on OpenAI though. :)
C outsold
Who else is watching this because they're upset at the R*** Foundation™
me 😂
First Rule of the R-word Foundation is you don't talk about the R-word Foundation
Me too haha
me 🤣
Rust is dead
24.0 good
24:00
Not gonna lie. Both of them are bad, the difference is one has the funds to be very very bad.
Why are you using the massive LLVM Libraries for Zig? An LLVM-only build requires anywhere from 1 to 3 GB of space on a machine.
A full build of LLVM and Clang will need around 15 to 20 GB of disk space. The exact space requirements will vary by system but damn.
They claim it's so large because of all the debugging information and the fact that the libraries are statically linked into multiple tools.
No Offence, however just before using Zig for your own Application Builds, your using a Program larger than a Linux Ubuntu OS just to achieve it.
You would be much better off to have gone with a Python Like Approach using C++ as a base language with an Interpreter instead right?
LLVM does not really compare to python, yeah small interpreter will be small but it’s still just an interpreter, LLVM basically gives you state of the art AST and amazing multi platform codegen, with all the micro optimizations you can dream of. You can’t really use python-like interpreter for mission critical stuff because it’s slow and non deterministic and ultimately forces you to include the entire runtime with your application to even run it.
I was with you until you said everyone loves Wikipedia.
When C++ was created it was compiled with cfront---a precompiler for the C language. You give your C++ code to cfront and it outputs a C program which can then be compiled with the available C compilers at the time. Because of this, C++ was gradually introduced to the C developers community. If a C developer wants to use a C++ feature not present in the C language, he would simple write that routine in C++, have it compiled to C, and immediately use it without breaking a sweat. There is no compulsion for the C developer to move their entire toolset to C++. Nor do they have to worry about C++ zealots calling his language, C, obsolete, buggy, and filled with arcane pointer arithmetic. Hah!
I am glad to see that Zig is following in the same footsteps as C++.
Compare C++ and Zig's attitude with that of Rust where the Rust community, without any provocation, is bent on antagonizing the entire C++ community by not even trying to cater to the needs of veteran programmers. They are so full of their own hot air, they keep on harping about the superiority of their language and how much faster and cleaner it is, that they are antagonizing the very community that they are trying to attract. I'm sorry. I don't have any need for a borrow checker or pointer-less code because I have made peace with memory allocation and pointer operations in C and C++. Rust has to offer me more than their borrow checker or whatever thingy they have before I make the leap from C++ to Rust.
I will not spend three or six months of my time, learning to use Rust and getting acquainted with its tools, quirks, and libraries, when in those very same six months there are tons of new technologies that I have to keep up with (eg CUDA, AI, WebAssembly containers, etc.) while also building software in the language appropriate for the project, be it C, C++, Python, WebAssembly, Bash, or even Java.
I therefore applaud Zig for doing the right thing by not forcing the veteran and professional programmers to discard their toolset, their procedures, their standards, their libraries, and all their other hard earned expertise just so they can be cool to newbie programmers. Python and Javascript did not win the language wars by antagonizing the C and C++ communities. Python and Javascript won because they offered something that C and C++ does not have: ability to work on the browser (in the case of Javascript) and good memory management, dynamic typing, and the REPL in the case of Python.
You wrote:
"I don't have any need for a borrow checker or pointer-less code because I have made peace with memory allocation and pointer operations in C and C++. Rust has to offer me more than their borrow checker or whatever thingy they have before I make the leap from C++ to Rust."
The problem you don't seem to see is that the industry will simply replace you with younger programmers who are willing to code in Rust.
@@OpenGL4ever Maybe? Maybe not? The problem with Rustaceans like you is that you still live in the 1980's when memory buffer overflows were still common. It is not as common now, kid. There are more hacks involving social engineering and surreptitious backdoors (have you heard of the xz backdoor put in, possibly by a state actor?) than buffer overflow vulnerabilities. The world has learned.
The problem with buffer overflow is a problem with the C language and not with C++. It is possible to write C++ code without malloc, fgets, and those other things that you people keep harping on about if one is willing to forego C compatibility. It's like your knowledge of programming ended in the 1980's. Yet, despite your fears, the Linux kernel is written in "unsafe" C and yet it is one of the most secure kernels around.
For your education, learn that a computer language is only part of a development system. What is equally important is the environment, the tools, the libraries, the institutional experience, and the decades of testing and use of the dev system. Rust isn't there yet.
Grow up. Your language is still in the hobbyist stage. Come back and take my job when Rust has become de riguer in AI, Game Engine, machine learning, and low latency programming.
A Rust fanatic may have convinced you to concentrate on Rust because it is "the language of the future." That may be so. But, kid, I hate to tell this to you, but until that actual future arrives, you and Rust will just live in unemployment land because you refuse to learn what is needed now instead of what is needed in the future.
Who knows? Maybe in the future AI will do all our programming so Rust and human programmers won't even be needed.
Zig is the real language of the future, not rust.
Both of them can coexist tho
😂 I'm waiting for that committee of geniuses that can fix Cobol! 😅
36:22 There is only one line needed in JavaScript :)
soydev detected
@@FlanPoirot Andrew used the colors of THE flag
it's over
the Rust Foundation had failed us, Zigggggg
joix
OpenAI was initially open source non-profit, but the board changed it to closed source for-profit. That's when Elon Musk resigned in protest.
Zig would be so good if it wood support Windows 7
Aren't there enough programming languages already?!!
Darrin Track
The guy is showing one fault of the American system. I refer to people willing to sell their business in order to bring their kids to college. That’s only an American thing. Education should be free or at least affordable
wikipedia is awesome... lmfao
Stoltenberg Road
Legros Mews
Mann Cape
Turner Heights
lol a really hateful view of VC startups and large corporations XD
Lind Islands