zig will change programming forever

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 ก.ย. 2024
  • For a long time, I really didn't understand where Zig fit in in the developer ecosystem. Now, I think I get it.
    🏫 COURSES 🏫 Learn to code in C at lowlevel.academy
    📰 NEWSLETTER 📰 Sign up for our newsletter at mailchi.mp/low...
    🛒 GREAT BOOKS FOR THE LOWEST LEVEL🛒
    Blue Fox: Arm Assembly Internals and Reverse Engineering: amzn.to/4394t87
    Practical Reverse Engineering: x86, x64, ARM, Windows Kernel, Reversing Tools, and Obfuscation : amzn.to/3C1z4sk
    Practical Malware Analysis: The Hands-On Guide to Dissecting Malicious Software : amzn.to/3C1daFy
    The Ghidra Book: The Definitive Guide: amzn.to/3WC2Vkg
    🔥🔥🔥 SOCIALS 🔥🔥🔥
    Low Level Merch!: lowlevel.store/
    Follow me on Twitter: / lowleveltweets
    Follow me on Twitch: / lowlevellearning
    Join me on Discord!: / discord

ความคิดเห็น • 1K

  • @LowLevel-TV
    @LowLevel-TV  5 หลายเดือนก่อน +88

    come learn about C and other languages at lowlevel.academy

    • @VivekYadav-ds8oz
      @VivekYadav-ds8oz 5 หลายเดือนก่อน +2

      can u pls give me ur course for free? i am in my pre-final year in uni and I have an intern in TI in a month, I need to get pro in C 🙏 im broke haalp

    • @nickbors-sterian
      @nickbors-sterian 5 หลายเดือนก่อน +1

      hey, if you could price your course better it would be great for us students. Im struggling to pay accomodation and my car payment (i need it to get to campus) but a student plan would greatly help but currently i am unable to afford your courses so im stuck with your generously provided free youtube content. I want to support you, but i need to support myself first :(

    • @AWIRE_onpc
      @AWIRE_onpc 5 หลายเดือนก่อน

      @@simpleprogrammingcodes i dont know c

    • @dylmm
      @dylmm 5 หลายเดือนก่อน

      Hey LowLevelLearning, you should probably include zig in the title of the first video about zig, I had the use youtube's channel search function to find it.

    • @kevinrineer5356
      @kevinrineer5356 5 หลายเดือนก่อน

      Wow that's pretty cheap for a lifetime license! I hope you get into MPI someday.

  • @foobar3202
    @foobar3202 5 หลายเดือนก่อน +1140

    You didn't even talk about one of the best features of Zig - seamless integration with C! It's really cool, you can straight import and start using C libs without writing any FFI.

    • @RFelizardo
      @RFelizardo 5 หลายเดือนก่อน +85

      This is what I was excited about, but when I started looking at using it for a pet project I started noticed that most folks still ended up writing bindings for common libraries anyway to get around issues with C APIs not being descriptive enough in some cases. Kind of ruins the magic. :(

    • @Sevenhens
      @Sevenhens 5 หลายเดือนก่อน +147

      "You didn't even talk about one of the best features of (C++) - seamless integration with C! It's really cool, you can straight import and start using C libs without writing any FFI." - lol

    • @matrix07012
      @matrix07012 5 หลายเดือนก่อน +18

      @@Sevenhens You can't every library though

    • @_somerandomguyontheinternet__
      @_somerandomguyontheinternet__ 5 หลายเดือนก่อน

      @@matrix07012 You can because C++ is a superset of C, meaning any C code is valid C++ code.

    • @foxwhite25
      @foxwhite25 5 หลายเดือนก่อน

      @@matrix07012 like you can use every library seamlessly in zig

  • @ImmiXIncredible
    @ImmiXIncredible 5 หลายเดือนก่อน +88

    Finally you got zig-pilled :D One nitpick though: in zig defer operates on block scope, not function scope! Go's defer is function scope. Little, but important difference

    • @TheSulross
      @TheSulross 4 หลายเดือนก่อน +12

      still not ready to embrace Zig myself - going to sit tight and wait for it's successor language Zag

    • @immige9216
      @immige9216 4 หลายเดือนก่อน +9

      @TheSulross better wait for zog then, it fixes all the stuff zag got wrong

    • @TheSulross
      @TheSulross 4 หลายเดือนก่อน +4

      @@immige9216 I confess that my real fantasy for Zag is to be a subset language of Zig that can be a Turbo Pascal like programming IDE that can run directly on 8bit and 16bit retro computers - or modern retro themed computers like the Agon Lite or the Commander X16. To do retro games development, of course. But where would be the fun in that if it didn't run directly on the target computer. 🙂

    • @JoseColonTV
      @JoseColonTV 4 หลายเดือนก่อน +5

      He said "defer macro". He has C Stockholm Syndrome. lol

    • @exnihilonihilfit6316
      @exnihilonihilfit6316 4 หลายเดือนก่อน

      I see the kids are here...
      goddamn time wasters

  • @mouradchelik4375
    @mouradchelik4375 5 หลายเดือนก่อน +79

    what alternate universe is this where C++ don't exist?

    • @negaopiroca2766
      @negaopiroca2766 4 หลายเดือนก่อน +3

      Word

    • @udderhippo
      @udderhippo 4 หลายเดือนก่อน +43

      A pleasant one

    • @somenameidk5278
      @somenameidk5278 3 หลายเดือนก่อน +5

      LLL despises C++ for some reason i can't quite figure out. (yes, i understand there's a lot of reasons not to like it but i can't tell which reason he has that lets him also like both C and Rust at the same time)

    • @udderhippo
      @udderhippo 3 หลายเดือนก่อน +24

      @@somenameidk5278 My guess is because C++ combines the worst bits of C (no safety) with the worst bits of Rust (complexity).
      C has simplicity and Rust has safety.
      C++ has neither.

    • @opposite342
      @opposite342 2 หลายเดือนก่อน +1

      Feature creep

  • @minirop
    @minirop 5 หลายเดือนก่อน +10

    defer not only "places" the code at the end of the function, but at all exit points (if there is an early return for instance) like a destructor in C++. (and the futur defer statement in C hopefully)

  • @CallousCoder
    @CallousCoder 5 หลายเดือนก่อน +2

    I adore it and I see it as definite language for new “C” projects. And definitely great no awesome for embedded. And C developers will build so much faster in Zig than Rust.

  • @illegalsmirf
    @illegalsmirf 5 หลายเดือนก่อน +1

    We don’t have enough programming languages please invent at least half a dozen more thanks

  • @VoxelPrismatic
    @VoxelPrismatic 5 หลายเดือนก่อน

    "But if you're not new here: Hi, I'm Theo, and I hate my mustache"

  • @skychip7784
    @skychip7784 5 หลายเดือนก่อน +1

    thanks for the sober security vid

    • @potatomaaan1757
      @potatomaaan1757 5 หลายเดือนก่อน

      You sure he wasn't drunk?

  • @OriginalJetForMe
    @OriginalJetForMe 4 หลายเดือนก่อน

    Do you ever talk about Swift?

  • @jameslay6505
    @jameslay6505 4 หลายเดือนก่อน +526

    Rust philosophy: make it hard to write bad code
    Zig philosophy: make it easy to write good code

    • @MustaphaRashiduddin-zx7rn
      @MustaphaRashiduddin-zx7rn 3 หลายเดือนก่อน +200

      c++ philosophy: you got this bro

    • @aaronhoush7184
      @aaronhoush7184 3 หลายเดือนก่อน +12

      I don't know, every large scale Zig project has a plethora of segfaults, I dont know if I consider that easy to write good code

    • @calvarezr
      @calvarezr 3 หลายเดือนก่อน +30

      @@aaronhoush7184 do you have a source? (not being sarcastic, I genuinely want to know about those cases)

    • @araz911
      @araz911 3 หลายเดือนก่อน +17

      python: i love rainbow

    • @colonthree
      @colonthree 3 หลายเดือนก่อน +2

      @@aaronhoush7184 That is weird. In most cases it seems like segfaults are caused by developers. OOB-ing arrays is something a lot of languages can do.

  • @maxturgeon89
    @maxturgeon89 5 หลายเดือนก่อน +260

    Pros and cons of C: you can do what the hell you want

    • @wiktorwektor123
      @wiktorwektor123 4 หลายเดือนก่อน +14

      Pretty much. Zig is not much different in that regard, but I still prefer to use Zig instead of C.

    • @nikkehtine
      @nikkehtine 4 หลายเดือนก่อน +62

      C:
      pros: it does exactly what you tell it to do
      cons: it does exactly what you tell it to do

    • @prismiemona
      @prismiemona 3 หลายเดือนก่อน

      You know what you doing

    • @yadeemkool5895
      @yadeemkool5895 3 หลายเดือนก่อน +2

      @nikkehtine nah, not so much. Lots of legacy stuff/knowledge issue with the language where you just have to know what it does by reading the specification exactly. Rust and zig are a bit nicer where I don't think there is not nearly as much oddities you have to remember and are more explicit on what they do.

    • @charliegnu
      @charliegnu 2 หลายเดือนก่อน

      Zig is the same except it asks you to explicitly tell it what the hell you want it to do while C can do things you didn't mean behind your back if you don't know any better.

  • @Elesario
    @Elesario 5 หลายเดือนก่อน +344

    After reading some of the comments my thought is "since when did programming languages become religions?"

    • @andrewdunbar828
      @andrewdunbar828 5 หลายเดือนก่อน +102

      Several decades ago.

    • @mgord9518
      @mgord9518 5 หลายเดือนก่อน +64

      Since their inception

    • @தமிழோன்
      @தமிழோன் 4 หลายเดือนก่อน +35

      Rust is king! Repent and learn Rust to experience heaven on Earth! Zig is for sinners.

    • @Rudxain
      @Rudxain 4 หลายเดือนก่อน +32

      If you've read "PHP: a fractal of bad design", you'll notice some obvious parallelisms between the PHP community and any cult/sect/religion. This also reminds me of the joke "Cult of Vim VS Church of Emacs"

    • @baxiry.
      @baxiry. 4 หลายเดือนก่อน +11

      Zig community is more logical.
      Rust community is more religious

  • @itr00ow93
    @itr00ow93 5 หลายเดือนก่อน +1209

    Zig is for puppygirls, rust for catboys

    • @zokalyx
      @zokalyx 5 หลายเดือนก่อน +169

      weird take but ok

    • @vinylSummer
      @vinylSummer 5 หลายเดือนก่อน +240

      Greatest take of the century

    • @itr00ow93
      @itr00ow93 5 หลายเดือนก่อน

      @@zokalyx arf arf

    • @howaretheygameing
      @howaretheygameing 5 หลายเดือนก่อน +133

      based take actually

    • @InternetExplorer687
      @InternetExplorer687 5 หลายเดือนก่อน +87

      most reasonable take i have heard this month

  • @CoolestPossibleName
    @CoolestPossibleName 5 หลายเดือนก่อน +223

    My takeaway: Learn everything!

    • @CyberDork34
      @CyberDork34 5 หลายเดือนก่อน +18

      Except C++ apparently, despite being more relevant and more widely used than either Rust or Zig

    • @Darkyx94
      @Darkyx94 5 หลายเดือนก่อน +24

      Rule 1 of low level programming, we don't talk about C++,
      Rule 2 of low level programming, if we're trying to find example, pretend everything was written in C

    • @mgord9518
      @mgord9518 5 หลายเดือนก่อน

      ​@@CyberDork34Because learning C++ means becoming a C++ programmer

    • @189Blake
      @189Blake 5 หลายเดือนก่อน

      ​@@CyberDork34learning c++ would take the same time than the other 3 combined 😅

    • @CyberDork34
      @CyberDork34 3 หลายเดือนก่อน

      @user-gi3mb3eu1m and some people want jobs

  • @zactron1997
    @zactron1997 5 หลายเดือนก่อน +360

    If I didn't have Rust, I'd definitely be using Zig. For me, the philosophy behind Rust and Zig is what matters: we can make the compiler do more work for you, so why don't we? While I appreciate certain problems are so much easier to solve in Zig than in Rust, the stuff I write works really well in Rust, and it just clicks for me mentally.

    • @scheimong
      @scheimong 5 หลายเดือนก่อน +35

      Agreed. I just wrote a microservice yesterday in Rust that takes a netcdf file and cuts out a subregion based on a geojson "selection". I've been writing rust for 4 years so I kind of knew what to expect, but I was still shocked when all the tests passed on the first try. I was so happy that I went bragging to my colleagues for the rest of the day 😅. And because it's rust, all possible errors have been handled gracefully and I don't have to worry about race conditions at all.
      Granted I used quite a bit of well-tested third-party libraries, but still there were about 1000 lines of my own code. I'm pretty confident when I say that had I written it in any other language (Go, Java, Cpp, or god forbid JS), debugging alone would have taken me at least 2 days.

    • @raylopez99
      @raylopez99 5 หลายเดือนก่อน +4

      @@scheimong 33% of software bugs cannot be caught by the Rust compiler.

    • @catto-from-heaven
      @catto-from-heaven 5 หลายเดือนก่อน +54

      @@raylopez99 33% is way better than 100%

    • @raylopez99
      @raylopez99 5 หลายเดือนก่อน +5

      @@catto-from-heaven True, if you can fight the compiler. I played around with Rust for a few months then gave up. If more devs adopt it, and it's taught in uni, it might have a future; same with Zig. Otherwise not and with AI on the horizon it might be moot.

    • @mgord9518
      @mgord9518 5 หลายเดือนก่อน +24

      ​@@raylopez99Except it's not moot. If AI becomes as good a programmer as everyone thinks it will be then we can just abandon all languages because the godly AI will program everything directly in fully-optimized machine code.
      At that point, maybe everything is moot. We can just abandon our jobs because the AI will do everything and give us UBI

  • @TheDolphiner
    @TheDolphiner 5 หลายเดือนก่อน +275

    One aspect of Zig I find so refreshing is how minimal it feels - you can comfortably go through the language documentation in a couple hours because there just isn't that much to learn. Zig comfortably gets so much done with comparably so few features.

    • @fr3ddyfr3sh
      @fr3ddyfr3sh 5 หลายเดือนก่อน +29

      Honestly, that sounds like Go 8 years ago.
      Or every sane language during their early years.
      It’s a fundamental law that the older a language gets, the more docs and features it will have.

    • @TheDolphiner
      @TheDolphiner 5 หลายเดือนก่อน +23

      @@fr3ddyfr3sh Sure, in practice some amount of that is inevitable - but to offer a reply to your example: Generics in Go needed to be a new feature added to the language. In Zig, the feature that was already there, comptime, is so powerful that it produces generics for free. Same for interfaces (as awkward as they currently can be).
      I don't want to get too hung up on this as a be-all end-all of how programming should be done, but it is my takeaway from the language in a comparable way to how I believe Rust popularized to many people what a modern typesystem could feel like.

    • @fr3ddyfr3sh
      @fr3ddyfr3sh 5 หลายเดือนก่อน +3

      I’m a little hyped for zig too.
      I always thought an expression-style try-catch feature would be cool, and zig simply has it out of the box :)

    • @189Blake
      @189Blake 5 หลายเดือนก่อน +7

      I heard that they want to follow C philosophy and keep the language as slim as possible.

    • @quinten01
      @quinten01 5 หลายเดือนก่อน +5

      @@fr3ddyfr3sh wym? Go is still like that today.

  • @krtirtho
    @krtirtho 5 หลายเดือนก่อน +271

    Zig is the best C toolchain ever

    • @mgord9518
      @mgord9518 5 หลายเดือนก่อน +12

      Which is pretty amazing considering that C is 50 years old and hasn't figured this shit out
      No reason I should have to install gigabytes of libraries for other architectures when I just want to link to them

    • @IamPyu-v
      @IamPyu-v 4 หลายเดือนก่อน

      Yea, it's amazing.

    • @matteo.veraldi
      @matteo.veraldi 4 หลายเดือนก่อน

      Is it? I am genuinely asking

    • @ZenoDovahkiin
      @ZenoDovahkiin 4 หลายเดือนก่อน +4

      @@matteo.veraldi You can use Zig as a replacement for make/cmake, etc, configured in Zig.
      Last I was aware, it was also getting a built-in package manager, so you basically get another dub/cargo/alire, but this one works not only for Zig, the language it's associated with, but also C. That's the idea at least.

  • @pierreollivier1
    @pierreollivier1 5 หลายเดือนก่อน +185

    Zig is definitely an amazing language, but there is so much you should have mentioned, maybe in another video, because as a C developer, Zig is really everything I wish C was.
    1 - It's simple and easy to use.
    2 - I'ts the most refactorable language (meaning you don't have to jump in 30 files fixing headers and function prototypes.
    3 - Comptime is capturing 90% of the power of C++ templates/Macros, while still being very readable and type safe.
    4 - The build system is insanely good, I replaced make/cmake with Zig, and with Zig itself it's really amazing.
    5 - Zig found the right balance of freedom, meaning you can do exactly what you are doing in C (aka crazy casting and weird stuff unlike Rust) but at the same time the language design makes it very inconvenient and verbose to do so. Which makes it actually easier to just to the right thing and not take any shortcuts. So for once the Type system is actually one that doesn't deceive you because of how loose it is like C or how tight it is like Rust.
    6 - Allocators are first class citizen. Even the Std is build around that which is amazing. I really don't get how a manual memory managed language like C didn't come with some form of interface for allocators.
    7 - The interops with C is the most natural, intuitive, and straightforward that I've ever seen. You literally just add an @cImport("header.h"); and a exe.addCsourceFile("") in your build.zig and you are good to go.
    8 - Zig also has integrated unit testing, which makes it so easier and cheaper to test code. In C I would literally spend 30 minutes writing some code and one hour testing it properly. In Zig you write a function write 2/3 tests forget about it and just do a quick zig build test and you are good to go. Which is also why it's so easy to refactor Zig btw.
    9 - No hidden memory allocation, no hidden control flow, everything you read is everything you get, you don't have to guess whether this functions aborts, returns -1 or 0, or whether it sets ernno.
    10 - The error handling and all the builting safety features makes it so much easier to write fast and correct code.
    I could go on an on but TLDR if you are a C developer you should definitely try Zig as I'm sure it's going to be the real C replacement. In System level programming.

    • @mgord9518
      @mgord9518 5 หลายเดือนก่อน +16

      I've been re-making a C project in Zig, started with a dumb 1:1 port and have slowly been implementing safety features and metaprogramming. It's pretty amazing how much more readable code becomes when you don't have to rely on 30 helper functions to extract data from packed structs like you do in C or Go

    • @pierreollivier1
      @pierreollivier1 5 หลายเดือนก่อน

      @@mgord9518 Yes that's for me one of my favorite features of the language, is just how much readable it is, at doing what you would do in C. One example that I love is logging. I'm a sucker for logging things to a file as a mean to debug, in C it's cumbersome, and you can't really use printf unless you also use fflush and all that jazz, you have to change the %_ to do anything, or you have to write your own implementation of printf, and even that is tricky and annoying, in Zig, you just implement a format functions, and you can call that type format function it's very easy and, with comptime you can automate that process, and basically recursively check the type of the field at comptime, to see whether it has a member called idk print, or if it's a simple type just use {any} with it it's really amazing..

    • @pierreollivier1
      @pierreollivier1 5 หลายเดือนก่อน +2

      @@mgord9518 I even forgot to mention how good and complete and portable the std is compared to C.

    • @jaivarsanb9194
      @jaivarsanb9194 5 หลายเดือนก่อน +2

      hello thanks for this review of zig and how it helps you. I'm curious to know how much does the zig compiler help prevent data race related bugs due to concurrency & also identifying or prevention of memory leaks.
      If possible please help it by comparison with rust/golang
      thanks.

    • @fluffy_tail4365
      @fluffy_tail4365 5 หลายเดือนก่อน +3

      also defer is so good, the video doesn´t go into detail but also it is made to substitute the goto: error pattern you would sue in C when you need deinit/deallocs. It is just C but improved for me

  • @cubemaster1298
    @cubemaster1298 5 หลายเดือนก่อน +429

    Let's all agree on the fact that Zig has by far the best build system. It is literally built into the language itself. No more bullshit Makefiles, pkgconf or Ninja. Don't even get me started with CMake.

    • @LowLevel-TV
      @LowLevel-TV  5 หลายเดือนก่อน +263

      you dont like having version control for your build systems build system? \s

    • @Adiee5Priv
      @Adiee5Priv 5 หลายเดือนก่อน +65

      Rust moment?

    • @ScibbieGames
      @ScibbieGames 5 หลายเดือนก่อน +136

      C++ dependency management can non-controversially be declared utter fucking dogshit.

    • @vintagewander
      @vintagewander 5 หลายเดือนก่อน +44

      We have cargo for rust tho

    • @Darkyx94
      @Darkyx94 5 หลายเดือนก่อน +33

      ​@@ScibbieGames I disagree, something that doesn't exist can't be dogshit

  • @AkitooMusic
    @AkitooMusic 5 หลายเดือนก่อน +81

    Zig is nice.

  • @Caesim9
    @Caesim9 4 หลายเดือนก่อน +11

    When I get asked "What language should I learn?" I think the obvious answer should be C, because like you said the majority of systems is programmed in C and because Zig has still not reached 1.0
    From my experience with Rust I can say that Rust FELT like a functional style programming language. It's focus on pattern matching, the immutability by default etc. It also has a lot of niceties of C++ (or some that C++ promised). But that means it also provides _some_ of the same footguns. Operator overloading, meaning that a line like a = b + c can be an unexpected heap allocation.
    I feel that Rust is the best language for programmers wanting system programming or high performance that come from functional languages or want many high level features.
    I feel Zig is closer to C than Rust is, like Zig has a "no hidden control flow" rule, it doesn't obfuscate how your data/ structs are on disk. I think it has a careful selection of features that make it nice to use for modern programmers. Especially:
    1. An explicit error type, making it possible for a function to either return a value or an error, like you showed in the video.
    2. A modern build system that doesn't depend on '#include's
    3. Defer and what you didn't show errdefer. Making it easily possible to free resources on exit if an error ocurred. Formalizing the goto err pattern known from C. And being more powerful than Go's defer.
    4. Very powerful tools to generate code and data structures at compile time. Even explicit loop unrolling with 'inline for'
    5. Bounds checking and for loops over slices with a value and index
    My favorite feature is that alloc operations explicitly are an operation which can fail. Sure in most cases it's a hassle and I just bubble the error up but being able to properly react in the 5% of cases where I want to react to Out Of Memory situations feels very empowering.
    I think Zig has the possibility to become a very serious contender for the low latency, high performance and or system programming space, while I don't think it is taking many of Rusts users because of their different abstraction levels. But that depends on it becoming stable.

  • @hacking4arabs
    @hacking4arabs 5 หลายเดือนก่อน +157

    At first, I was suspicious of Zig, thinking it was just another pointless endeavor. However, after giving it a try, I'm now addicted to it. I've been able to accomplish incredible things that I couldn't achieve with other languages

    • @FlanPoirot
      @FlanPoirot 5 หลายเดือนก่อน +25

      I enjoy Zig, Rust and Odin. they're give u different opinions and perspectives on the low level coding niche :)
      I like them for different reasons and I personally wish all 3 get popular and embraced by the broader community

    • @echoptic775
      @echoptic775 5 หลายเดือนก่อน +60

      What did you accomplish that you couldn't do with other languages?

    • @xaxfixho
      @xaxfixho 5 หลายเดือนก่อน

      You should try frenti 😉

    • @andrewdunbar828
      @andrewdunbar828 5 หลายเดือนก่อน

      @@FlanPoirot With you on this!

    • @Adiee5Priv
      @Adiee5Priv 5 หลายเดือนก่อน +1

      Endeavour os?

  • @samdavepollard
    @samdavepollard 4 หลายเดือนก่อน +23

    that rare thing - a youtuber prepared to admit that they changed their mind
    subbed

  • @BrainySmurf77
    @BrainySmurf77 5 หลายเดือนก่อน +25

    Nice video! Some good pros for Zig, and you didn't even get to its build system, which is arguably even more impressive in concept than the language itself.

    • @poggarzz
      @poggarzz 5 หลายเดือนก่อน

      As a c/c++ enjoyer, zig is the only one I tried out of the "hot new" languages. so far, I am loving it.

  • @TheyCallMeHacked
    @TheyCallMeHacked 5 หลายเดือนก่อน +17

    I think Zig also fills another role : it's a better alternative to unsafe Rust. If I have a Rust function I'm about to mark as entirely unsafe, I think twice and rewrite it in Zig. I think unsafe Rust has more footguns than Zig does, and has a much clunkier syntax.

    • @wiktorwektor123
      @wiktorwektor123 4 หลายเดือนก่อน +1

      That true, "unsafe" Zig (which is whole language) is safer than unsafe Rust.

  • @obkf-too
    @obkf-too 5 หลายเดือนก่อน +9

    I would also recommend Odin programming language, it is similar to zig yet feels different, people like using it for GUI applications, Game development,...
    The creator GingerBill is a friend of Andrew Kelly the zig creator, they influenced each other to make these languages what they are now.

  • @santitabnavascues8673
    @santitabnavascues8673 4 หลายเดือนก่อน +4

    Any language that claims to be the next big thing has to drop any intentions of not allowing the programmer to shoot himself on the foot. Otherwise it is wasting time handholding the user that could be used elsewhere. And produce binaries, not bytecode

  • @Leonhart_93
    @Leonhart_93 5 หลายเดือนก่อน +93

    Zig's purpose is not a thing because "Rust is too hard", since it sounds like you are uplifting Rust to a new high. Rust is too restrictive and inherently doesn't trust the developer to write good code, which sounds more like the reason why Zig is an alternative.
    Zig's purpose is to be a modern C, that's it. Complete control over memory with more easily usable features like error handling and perfect inter-operability with C.
    And also, Zig's standard library is insanely clear and accessible. You get it out of the box in plain Zig code and it can be one hell of a tutorial in the advanced Zig features if you study the implementation of everything.

    • @nathanfranck5822
      @nathanfranck5822 5 หลายเดือนก่อน +8

      Zig makes "memory soundness" another problem to solve eventually instead of a requirement for getting your code to run initially. Which is good if you are trying things out, and don't know exactly what you have set out to build. I can build a giant system that leaks like crazy and then solve the leak once I'm happy with the behaviour and design later.

    • @Leonhart_93
      @Leonhart_93 5 หลายเดือนก่อน +15

      @@nathanfranck5822 Maybe you can make that argument for C, but Zig handles a lot of that with the "defer" statements, custom allocators and error handling.
      And even with that argument, hardcore engineers with still pick C over everything, because they like power and control, and are not afraid of using memory. But they may be somehow inclined towards Zig since it allows doing all of that.

    • @angeldude101
      @angeldude101 5 หลายเดือนก่อน +31

      "Rust ... inherently doesn't trust the developer to write good code."
      Considering I don't trust myself to write good code, and barely trust others to write good code, Rust seems pretty perfect for me.

    • @arson5304
      @arson5304 5 หลายเดือนก่อน +1

      why is it too restrictive, i've yet to be held back by chains from the language

    • @nathanfranck5822
      @nathanfranck5822 5 หลายเดือนก่อน +6

      @@arson5304 Yeah Rust isn't bad if you just clone() everywhere, but then it runs significantly slower than JavaScript or Go for the same algorithm. Doing the easiest thing in Zig generally results in really fast single threaded code (talking small CLI apps with some hash maps, lists, iterations, from experience)

  • @afridi501
    @afridi501 5 หลายเดือนก่อน +19

    Lol I want to know about c++

  • @aniketbisht2823
    @aniketbisht2823 5 หลายเดือนก่อน +43

    As a C++ dev, Rust sucks but Zig comes close to what modern C++ offers you without any bullshit.

    • @heavymetalmixer91
      @heavymetalmixer91 5 หลายเดือนก่อน +2

      In what way?

    • @dwight4k
      @dwight4k 5 หลายเดือนก่อน +2

      @@heavymetalmixer91 I would like to know as well.

    • @Sevenhens
      @Sevenhens 5 หลายเดือนก่อน

      Modern C++ is good...if you can close your eyes to the ugly ugly BS and drama and bikeshedding over implementations. FFS unordered_map and regex are still broken and will never be fixed. Runtime exceptions are the cause of a holy war that Google wages against the standards committee. 3rd party packaging and the CMake build system being a complete mess (second only to Python's mess). Tons of legacy footguns that the standards committee refuses to deprecate or atleast warn against using like vector. Networking...LOL.
      Despite all of that...modern C++ niceties like ranges and constexpr/consteval are genuinely cool to have in a programming language.

    • @aniketbisht2823
      @aniketbisht2823 5 หลายเดือนก่อน +1

      @@heavymetalmixer91 C++ and Zig both have excellent compile-time computation capabilities : proc macros in Rust are a language of their own whereas in C++ you write almost the same code as you would for "runtime".
      C++ templates combined with constexpr make for a powerful metaprogramming system. The only thing that is lacking is a Reflection system (the proposal is on its way for standardization in C++26). Rust's macro system is tedious and an expert-only feature. For anything sophisticated, you have to reach out to them. For example: "println!" in Rust is a macro while in C++ std::print (which is more flexible) is just another function template.
      Rust also includes many runtime checks which you cannot get rid of in release builds, unlike the "NDEBUG" macro in C/C++.
      Rust is an awesome language for "application" developers who won't be writing any "low-level" code themselves and instead would use libraries for the same (which are most developers). But it is very tedious for library authors who might find the language limiting at times.

    • @aniketbisht2823
      @aniketbisht2823 5 หลายเดือนก่อน +1

      @@heavymetalmixer91 C++ and Zig both have excellent compile-time computation capabilities : proc macros in Rust are a language of their own whereas in C++ you write almost the same code as you would for "runtime".
      C++ templates combined with constexpr make for a powerful metaprogramming system. The only thing that is lacking is a Reflection system (the proposal is on its way for standardization in C++26). Rust's macro system is tedious and an expert-only feature. For anything sophisticated, you have to reach out to them. For example: "println!" in Rust is a macro while in C++ std::print (which is more flexible) is just another function template.
      Rust also includes many runtime checks which you cannot get rid of in release builds, unlike the "NDEBUG" macro in C/C++.
      Rust is an awesome language for "application" developers who won't be writing any "low-level" code themselves and instead would use libraries for the same (which are most developers). But it is very tedious for library authors who might find the language tedious and limiting at times.

  • @rsalmei
    @rsalmei 4 หลายเดือนก่อน +3

    So, it's "allowed" to just return a reference to a dangling pointer?? Really?? That's not the future of programming, that's garbage!! It's not enough to "get a taste" of memory safety nowadays, sorry.

    • @Presenter2
      @Presenter2 หลายเดือนก่อน

      Yeah, I really don't understand why Zig allows for that. It still has a lot more safety features than C though.

  • @angeloceccato
    @angeloceccato 5 หลายเดือนก่อน +25

    In May, there is "the software you can love" in Milan. They'll speak about zig and system programming! I already took the ticket!

    • @ChipKeefer
      @ChipKeefer 4 หลายเดือนก่อน +1

      I went. It was terrific!

    • @angeloceccato
      @angeloceccato 4 หลายเดือนก่อน

      @ChipKeefer Argue please

  • @jvillasante
    @jvillasante 5 หลายเดือนก่อน +34

    I mean, when talking about system languages saying that we are not going to talk about C++ in here is like saying "let's talk about GPUs, but not you NVIDIA" :)

    • @zackyezek3760
      @zackyezek3760 5 หลายเดือนก่อน +8

      Yeah, let’s not talk about c++ when it’s BEEN the “higher level C replacement” for about 40 years now & is the only language anywhere close to C in terms of widespread usage for systems (or even just compiled) code.
      Zig seems to be an attempt to merely replace C rather than Rust, which is clearly going after C++ too. Being a new, de facto rewrite of C rather than trying to replace both wholesale probably is the better design & strategy. Especially because linker ABI compatibility with C lets you become a transparent drop in replacement, ironically the SAME THING K&R C did to FORTRAN by making it trivially simple to link Fortran libs into C programs.

    • @TheSulross
      @TheSulross 4 หลายเดือนก่อน +3

      yeah, the waves of weird anti C++ bias just tsunami rolled me

    • @uzoochogu
      @uzoochogu 4 หลายเดือนก่อน +4

      @@TheSulross Yes, it is almost like a trendy thing to just hate C++. Very cliche. Yet all their fancy tools are built with C++.

    • @dainess2919
      @dainess2919 4 หลายเดือนก่อน +1

      When C++ devs die they don't leave a corpse, it goes on a puff of black smoke straight to hell

  • @Vifnis
    @Vifnis 5 หลายเดือนก่อน +9

    "you should learn all the things"
    You know I'm not gonna do that, Ed.... my brain isn't big enough yet

  • @stighemmer
    @stighemmer 4 หลายเดือนก่อน +6

    The reason to learn C is not to use it (much), but because it makes you understand the computer better.

  • @mrlithium69
    @mrlithium69 5 หลายเดือนก่อน +16

    can you put zig in the title please ? not everyone can see the thumbnail

    • @kesslerdupont6023
      @kesslerdupont6023 5 หลายเดือนก่อน

      also for searching "zig" on YT

  • @corneliusisaac7839
    @corneliusisaac7839 4 หลายเดือนก่อน +7

    I love watching your videos but I feel this hatred for C++ that hurts. C++ is amazing then many of you can comprehend.

    • @roiqk
      @roiqk 3 หลายเดือนก่อน

      The thing is he’s a TH-camr mainly and not a developer. Thus to gain views and attention he has to praise the new and for engament hate the old. Irl Rust and Zig are not even close to C++ in terms of usage and actual things build with it.

    • @user-eg6nq7qt8c
      @user-eg6nq7qt8c 3 หลายเดือนก่อน +1

      @@roiqk not even close in terms of usage? that's obvious given the age of the languages.

    • @roiqk
      @roiqk 3 หลายเดือนก่อน

      @@user-eg6nq7qt8c agreed

  • @size_t
    @size_t 5 หลายเดือนก่อน +6

    I have to think about the video "Interview with Senior Rust Developer in 2023" from "Programmers are also human", where he said "They don't like 'unsafe' in my code, so just stuff it into macros"

  • @mr.wasgehtsiedasan1564
    @mr.wasgehtsiedasan1564 หลายเดือนก่อน +2

    I hate their "and" and "or" instead of "&&" and "||" like in all other languages ...

  • @m4rt_
    @m4rt_ 5 หลายเดือนก่อน +15

    technically, defer runs at the end of the current scope, not function scope. so if you have something like this:
    fn main() {
    {
    defer print("b");
    print("a");
    }
    print("c");
    }
    you get this:
    a
    b
    c
    if it was at the end if the function it would be this:
    a
    c
    b
    if it ran at the end of the function scope rather than watever nested scope it's in, it would try to free a pointer that is out of scope, which doesn't work.

  • @velitskylev7068
    @velitskylev7068 5 หลายเดือนก่อน +2

    C++ hater detected. Push this message to the top. Let the holy war begin!

  • @nathanfranck5822
    @nathanfranck5822 5 หลายเดือนก่อน +53

    Zig makes 1000% more sense for game dev IMO ... Dont want to be worrying about Arc when I'm just trying to do stuff. Zig's "reflection" is also amazing for game dev stuff like network\io serialization, GUI etc

    • @Leonhart_93
      @Leonhart_93 5 หลายเดือนก่อน +19

      Yes, for that you need something with real control, instead of giving you bits and pieces always wrapped in some insanely complicated proprietary memory management system like Rust.

    • @andrewdunbar828
      @andrewdunbar828 5 หลายเดือนก่อน +9

      Have a look at Odin. I like Zig and Odin but Odin might be even more game friendly.

    • @nathanfranck5822
      @nathanfranck5822 5 หลายเดือนก่อน +9

      @@andrewdunbar828 Yeah, the builtin Quat, Vector and Matrix types in Odin definitely helps with ergonomics. Also the context object to pack allocators and debugging tools into. I'm sticking with zig for now, and having a good time with the killer zig features so far, though the ergonomics aren't as good as Odin

    • @heavymetalmixer91
      @heavymetalmixer91 5 หลายเดือนก่อน

      Does Zig have OOP?

    • @nathanfranck5822
      @nathanfranck5822 5 หลายเดือนก่อน +5

      @@heavymetalmixer91 You can pack data into structs and give them methods --- the best parts of OOP :)
      If you want interfaces and inheritance, it's not a first-class feature, you'd have to use anytypes and make some (arguably cool) comptime code to build up those concepts again, you'd get worse tooling and the community isn't generally impressed with it

  • @fb-gu2er
    @fb-gu2er 5 หลายเดือนก่อน +2

    I don’t get all the hate for C++. It’s one of the most powerful and successful languages ever invented. Sure, old C++ was quite unsafe. But modern C++ with smart pointers is quite safe. It’s comparing apples and oranges. After C++11 the language changed dramatically. If you use raw pointers in C++ nowadays, with some exceptions, you’re doing it wrong

    • @wormisgod
      @wormisgod 5 หลายเดือนก่อน +1

      Because it's popular to do so amongst "influencers" and vocal online circles. In reality, the world runs on established languages like C++ and Java. Anyone seeking a quiet, stable career would be better off learning C++ than the next new shiny thing.

    • @inkryption3386
      @inkryption3386 5 หลายเดือนก่อน +1

      C++ is a kitchen sink of overly complex gobbledygook

  • @ErikBongers
    @ErikBongers 5 หลายเดือนก่อน +3

    If you're going to "try Zig, C and Rust", I think there's a good chance you'll stick with Zig, because C will constantly crash and Rust will be a constant fight with the borrow checker.
    Having said that, Rust is still compelling because of it's memory safety.

  • @Arunnn241
    @Arunnn241 3 หลายเดือนก่อน +2

    So Zig is Go but for manually managed memory languages. Cool

  • @InvaderTakko
    @InvaderTakko 5 หลายเดือนก่อน +14

    Would be cool if you checked out Odin as well. Its quite similar to Zig but in my opinion more ergonomic/readable and at least on the language side more mature. Doesnt have as much traction and a smaller community tho.

    • @andrewdunbar828
      @andrewdunbar828 5 หลายเดือนก่อน +5

      Odin is a fair bit more C-like than Zig even though it is also fairly Pascal-like.

    • @eduardabramovich1216
      @eduardabramovich1216 5 หลายเดือนก่อน +1

      @@andrewdunbar828 Yes sir, Zig is simple, but Odin is more simple.

  • @MelkeyDev
    @MelkeyDev 4 หลายเดือนก่อน +1

    I know this guy.
    this guy makes good videos.
    he is so handsome.
    I am big fan

  • @awesomedavid2012
    @awesomedavid2012 5 หลายเดือนก่อน +11

    I hate to be one of these people, but you should check out Odin if you haven't. It seemingly fits in a similar place as Zig, but with a completely different mindset. I like that in Odin, you have access to allocators and calling conventions, but they aren't forced on you; you can just call new and use the default allocator.

  • @G.B...
    @G.B... 3 หลายเดือนก่อน +1

    There are other choices when it comes to languages (without a garbage collector, of course). You probably never used any of those - not seriously, at least. That would be perfectly ok, except new programmers would watch this and would think their choices are C or Rust, or even Zig (just because it's new it's automatically better, right?)
    And, for Devil's sake, C is a powerful language? It's as powerful as a high-level Assembly, because that's exactly what it is.

  • @aboliguu1168
    @aboliguu1168 5 หลายเดือนก่อน +23

    3:01 I believe C++ fits in the middleground too. Many people just have a religious attitude towards it because it is very full and complex. (I guarantee that most avid C++ haters have never even touched it’s surface.)
    If you write modern C++ with reasonably good practises, memory safety is not that difficult. Most of the time you don’t even need to allocate and free memory because things like smart pointers and std::string hide that away.

    • @coolbrotherf127
      @coolbrotherf127 5 หลายเดือนก่อน +16

      Very true, people shouldn't be writing C++ like it's still 1985. Most of its "problems" are from people who aren't up to date on best practices which isn't C++'s fault.

    • @monochromeart7311
      @monochromeart7311 5 หลายเดือนก่อน

      @@coolbrotherf127 Most of its problems are from its horrible design.
      Implicit type coercion? Nice, the std::string got stored as a std::string_view (a modern C++ feature).
      You passed a variable to a function and you didn't know you passed a reference? Well now it's modified.
      The std::unique_ptr is a nullptr? Yes, because std::unique_ptr can be empty.
      I'll give you another example - std::optional
      Its default constructor is either std::optionaloptional(std::nullopt_t) or std::optionaloptional().
      The latter constructs a T, anytime T has a default constructor (most types do). You do know that returning {} is common with optionals in real code, right?
      That's a bad design.
      Another example is std::vector::operator[](size_t) not doing bound checks, which results in a lot of bugs.
      Or how the iterator model makes it easy to have errors like std::copy() and you forgot to use std::back_inserter. Now C++20 and after has ranges and views, which use operator overloading again...
      Didn't we learn from the infamously slow std::iostream that uses a lot of inheritance?
      I can keep on going, and you can keep saying it's a skill issue. But in reality most developers are average and it's why professional places have half-a-dozen different sanitizers.

    • @Uvuv6969
      @Uvuv6969 5 หลายเดือนก่อน +7

      C++ is my second language, the one I actually tried in because Python made (and still makes) significantly less sense to me. C++ is honestly a well made language in my eyes. Definitely some issues,but so does every language.

    • @wormisgod
      @wormisgod 5 หลายเดือนก่อน +6

      C++ with modern constructs and strict adherence to RAII is safe enough, especially for quick prototypes and fast-changing stuff.

    • @poggarzz
      @poggarzz 5 หลายเดือนก่อน +4

      @thetukars I mean that's what you get when you try to maintain backwards compatibility to keep the code running in a hardware from stone age time. The modern stuff is pretty clean tho. (IMO build system still sucks ass tho)

  • @stevetrotter7843
    @stevetrotter7843 3 หลายเดือนก่อน +1

    Disclaimer, have written lots of Rust/Go/C (about that order) but no Zig at all. Before watching this, isn't Zig just C but if C was written in 2020 rather than 1970? That's what it seems to be to me, it's not really new, but it's got lots of modern things we expect like package management, we learned how not to do a lot things, etc etc. Where Rust on the other hand does something fundamentally different, requires a new way of thinking, causes more pain at times but is also more likely (no not guaranteed, I know) to produce correct code at the other end but harder. I totally think though that having a new C is a way good idea and therefore Zig is a good idea, there's totally space for that in the systems programming ecosystem.
    After watching I still feel like that's a good synopsis, obviously the panics are an improvement over segment faults for sure, but this is still just what any 2020 version of C would definitely have. Agree with the conclusion as well, they all seem to have their place, great video, and glad something is filling that space, I would definitely happily use Zig, but mostly I'll likely stick to Rust as I've kind of already gone through the pain barrier there (but not always, it still sometimes denies valid programs and takes me out of my developer flow).

  • @Alendrik
    @Alendrik 5 หลายเดือนก่อน +5

    quick mention to nim, optional gc, small binaries, and great interop with c code. great to look at, but struggles with a smaller community and worse documentation.

    • @priyanshu3331
      @priyanshu3331 4 หลายเดือนก่อน +1

      Well, there is also D language, it has a great interop with c and c++. Like Go, it's compiled. It also has an optional GC. The syntax is C like, has very good performance. Honestly I would say it's an extremely underrated language.

  • @BachenBenno99
    @BachenBenno99 5 หลายเดือนก่อน +18

    Hold on, why are we not talking about C++? Did I miss something?

    • @BachenBenno99
      @BachenBenno99 5 หลายเดือนก่อน

      @@31redorange08 ok, but why?

    • @1zui
      @1zui 4 หลายเดือนก่อน +4

      Probably because with C++, there is no reason to use C at all.

    • @roiqk
      @roiqk 3 หลายเดือนก่อน

      @@1zuilol

  • @_slier
    @_slier 3 หลายเดือนก่อน +2

    no sirree bob. Odin, C3 is way better.. they just need better PR. they can beat zig anytime

  • @tenv
    @tenv 4 หลายเดือนก่อน +3

    It's one thing for Zig to improve and modernize C whilst still keeping the language small and lean, that would make it a great lang on its own. But then comptime... honestly its the best approach to generics I've seen, and it happened by accident! Best lang 10/10

  • @colonthree
    @colonthree 3 หลายเดือนก่อน +1

    The allocators remind me of how it is done with unmanaged arrays in Unity's Burst. OwO

  • @sieunpark2160
    @sieunpark2160 5 หลายเดือนก่อน +3

    Regardless of what language is practical, they probably won't employ as much Zig programmers as C programmers for a long, long time.

  • @MaxHaydenChiz
    @MaxHaydenChiz 5 หลายเดือนก่อน +2

    The way you talked about garbage collection vs malloc has the potential to be misunderstood or taken out of context. I think you mean that malloc/free are "deterministic" in the sense that you can point to a specific given line of code where the allocation and de-allocation take place. (Though, with smart pointers, deallocation can easily become non-deterministic, even this sense.)
    But usually people use "deterministic" in a more restrictive way. Normally, you'd say that malloc/free are non-deterministic in that they can take an unbounded amount of time. In a long-running application, you could end up with fragmented memory, and all kinds of other crazy things could happen when you call those functions. So they aren't real time safe and shouldn't be called from code that needs to make real-time guarantees.
    As a general rule, if you need deterministic memory usage, you have to allocate everything statically, or at least right at the start when the system turns on and then never again. In such systems, you don't use dynamic memory. With that and a few additional restrictions, you can calculate exactly how much stack space and other resources you need to handle the worst case scenario.
    However, there are a handful of situations where you do need to manage memory dynamically in a real-time system. As far as I am aware, the only known general purpose techniques for doing this wait-free involve garbage collection algorithms. (The same goes for lock-free approaches.)
    5 years ago, I'd have said that these use cases were so obscure that they weren't worth mentioning, but so many consumer devices now have real-time components and mixed criticality workloads that this isn't a specialized topic anymore. We have cost effective multicore embedded SoCs, and even extremely cheap single core processors can get by with the "speed" of interpreted Python. Hardware features like transactional memory support are becoming more broadly available too.
    So, I think that we are going to start to see real-time garbage collection algorithms out in the wild before too long. Even if people aren't using specialized real-time algorithms that need them. If you need the real-time code on a camera or a drone to interface with a system to communicate with people's phones over bluetooth, that's going to force the issue, especially if devs want to use normal open source software libraries for the non-essential portions of their code even if those libraries weren't written with real-time systems in mind.
    I haven't found a "good" set of tools that supports this type of development, but maybe Zig will be the language to do it given how explicit it is about passing allocators around.

  • @somethingheimer
    @somethingheimer 5 หลายเดือนก่อน +9

    Why does this guy hate C++ so much lmao

    • @Hermaeus7
      @Hermaeus7 5 หลายเดือนก่อน +1

      Can’t into probably

    • @minimumt3n204
      @minimumt3n204 4 หลายเดือนก่อน

      Or into maybe

  • @CoreDumpped
    @CoreDumpped 5 หลายเดือนก่อน

    "Hacked by hackers", cause AI cannot hack... yet.

  • @marsrocket
    @marsrocket 3 หลายเดือนก่อน +3

    I’m waiting for zag.

  • @magne6049
    @magne6049 3 หลายเดือนก่อน +2

    downvoted for misleading title according to content/conclusion.

    • @magne6049
      @magne6049 3 หลายเดือนก่อน +1

      "zig is the future of (systems!) programming if you think C is too unsafe but Rust is too hard" (ref 2:50)... is a far cry from "zig is the future of programming"

  • @darkfllame
    @darkfllame 5 หลายเดือนก่อน +32

    it really depends on what domains you want to work on:
    embedded systems: zig
    games: zig
    webdev: zig
    os: zig
    c: zig
    networking: zig
    automation: zig

    • @mgord9518
      @mgord9518 5 หลายเดือนก่อน +10

      Also:
      Build system: zig
      C++ compiler: zig
      JS runtime: zig
      Just use the right tool for the right job

    • @RiwenX
      @RiwenX 5 หลายเดือนก่อน +1

      Embedded zig? I mean, have you been doing any embedded stuff? After years, Rust has finally reached the point where it's usable for embedded (well, for MCUs whose vendor supports it officially, ot there is good community support). I simply cannot see Zig being a productive language for embedded for years to come; that is, if vendors/community pick it up. Which is doubtful at best.

    • @perfumedeath6042
      @perfumedeath6042 5 หลายเดือนก่อน

      Nice 😂

    • @adnanalshami3751
      @adnanalshami3751 5 หลายเดือนก่อน

      @@mgord9518 the right zig for the right job 😁

    • @stefankyriacou7151
      @stefankyriacou7151 4 หลายเดือนก่อน +1

      @@RiwenX My understanding is that because zig is designed to be completely interchangeable with c without any ffi, it should generally just work? I could be missing something though.

  • @NeilMayhew
    @NeilMayhew 5 หลายเดือนก่อน +1

    Please don't write utilities that put options after arguments on the command line. That goes against 50 years of convention! If necessary, allow arguments and options to be interspersed, but in the usage message don't write ' '. If nothing else, that's very confusing to Mac and Linux users who have to put options before arguments on almost all traditional CLI utilities.

  • @mockingbirdex3450
    @mockingbirdex3450 5 หลายเดือนก่อน +14

    How Zig compares to Odin?

  • @science_trip
    @science_trip 2 หลายเดือนก่อน +1

    In these new sruff like rust and zig the code looks very quick unreadable even for very small portions of code. This is the most important reason than I m not still using them for real projects. Zig has an other huge problem too. The problem is the breaking changes in EVERY sub version. it's not serious language yet. it's just an experiment

    • @JohnDoe-np7do
      @JohnDoe-np7do 2 หลายเดือนก่อน +1

      Zig + wasm 🥴

  • @michelromero7671
    @michelromero7671 5 หลายเดือนก่อน +3

    Why not C++? I'm just curious, is it actually that problematic like the "blow the entire leg off" meme?

    • @arson5304
      @arson5304 5 หลายเดือนก่อน +5

      the language is just really hard to work with, there are just so many decades of bad design decisions stacked on top of each other that the language has become so bloated. they're trying to fix all of it now, but it's too little too late: c++20 concepts, c++20 views, c++23 expected, and so on.

    • @michelromero7671
      @michelromero7671 5 หลายเดือนก่อน +1

      @@arson5304 this you say in the context of system's programming or in general?

    • @arson5304
      @arson5304 5 หลายเดือนก่อน

      @@michelromero7671 in general, but that also includes systems programming

    • @cantthinkofaname1029
      @cantthinkofaname1029 4 หลายเดือนก่อน

      C++ remains my favorite systems programming language due to how features complete it is (compared to the other options), these upcoming ones are cool but I'm mostly looking forward to the changes it makes in future c++ updates as it learns from the competition

    • @arson5304
      @arson5304 4 หลายเดือนก่อน

      @@cantthinkofaname1029 lol i gave up trying to cope with the decades of bad decisions a long time ago, rust is so much better

  • @romangeneral23
    @romangeneral23 5 หลายเดือนก่อน +3

    Zig RULES!!!
    Rust sucks

  • @NeuwDk
    @NeuwDk 5 หลายเดือนก่อน +3

    I'm genuinely curiously, why won't you even get into C++?
    As someone who learned C then Rust and is now learning C++ - I don't understand all the hate. Subjectively, I don't think it is that bad. Sure you can shoot yourself in the foot, but that's not easier than in C. As I'm doing scientific computing, I find C++ is often more flexible and adaptable for my use cases.
    I don't have enough experience with Zig to have any opinion on it except it looks cool, but not ready for use yet.

    • @roiqk
      @roiqk 3 หลายเดือนก่อน +1

      Look he is a TH-camr and not a developer. So he praises the new to get views and hates the old to get emgament. Of course IRL C++ is the king. But that won’t get many views…

  • @AnoNym-zi5ty
    @AnoNym-zi5ty 4 หลายเดือนก่อน +1

    I thought he was gonna say Go is garbage. It wouldn't be wrong.

  • @DiThi
    @DiThi 5 หลายเดือนก่อน +5

    I hope you take a look at nim some day. Many of the zig features you've mentioned are also in nim, and it has many more that I would miss in zig. It's more high level than zig, but at the same time very low level when you need it to be.

    • @mitchelvalentino1569
      @mitchelvalentino1569 5 หลายเดือนก่อน +6

      Nim’s flexibility is great. I enjoy it more than I ever expected.

    • @adriancruz2822
      @adriancruz2822 5 หลายเดือนก่อน +1

      I did not enjoy Nim.

    • @andrewdunbar828
      @andrewdunbar828 5 หลายเดือนก่อน

      I'd put Odin somewhere between Zig and Nim. Nim felt like it has less momentum and I didn't look at it as deeply as the others because of that.

  • @stolenlaptop
    @stolenlaptop 5 หลายเดือนก่อน +1

    Let me say this. This.... Haha , just use c and stop messing with the fads the world is better if we all just get good at using the tools we got instead of just building a house of cards. It's not like the cpus we use dont have back doors anyhow sooo.

    • @inkryption3386
      @inkryption3386 5 หลายเดือนก่อน +1

      Why even use C? We should just go back to using COBOL and B

  • @adriancruz2822
    @adriancruz2822 5 หลายเดือนก่อน +9

    You should take a look at Odin. It's very much in the same space.

  • @fangornthewise
    @fangornthewise หลายเดือนก่อน +1

    Noob here. What's with the scoff towards cpp? lol 1:04

  • @billyjoejimbob75
    @billyjoejimbob75 5 หลายเดือนก่อน +4

    Zig? For great justice, obviously.

    • @rhone733
      @rhone733 2 หลายเดือนก่อน +1

      Only if you take off every one.

  • @mar.m.5236
    @mar.m.5236 5 หลายเดือนก่อน +2

    Not doing dev anymore but coming from a VHDL, firmware, bootloader, kernel background and after just playing with the zigling "tutorial": this is the language I would have like to have during my low-level dev phase. It seems to make all the dangerous things quite visible and therefor controllable... I hope to see this language used more in the future (besides nim.... ;-) )

  • @TheSulross
    @TheSulross 4 หลายเดือนก่อน +3

    immediately puts bias on display to bash C++ yet the entirety of the SerenityOS is written in C++, which is moving along at a rather rapid pace and is already branching out to include support for ARM and RISC-V, IOW C++ by explicit illustration is a perfectly capable systems programming language

    • @Hexanitrobenzene
      @Hexanitrobenzene 4 หลายเดือนก่อน +2

      Nobody criticises the capabilities of C++, it's the design people have issues with. I'm not an expert, but... :)
      The design feels like "We have features A, B and C aimed at this problem. Which one goes into the standard ? .... To hell, let's add all of them, the devs will choose." C++ is a big and complex language with no clear design vision, so everyone picks the subset they like. That makes it hard to understand code of others. It's the main reason C++ was not allowed into Linux kernel.
      ...at least that's the opinion I formed after reading many critiques of C++ by expert programers.

  • @owenwexler7214
    @owenwexler7214 5 หลายเดือนก่อน +2

    Zig exists to write Bun, obv

  • @fourbytes1
    @fourbytes1 5 หลายเดือนก่อน +8

    Is Zig suitable as a first programming language? Is it worth investing your time in it?

    • @not_kode_kun
      @not_kode_kun 5 หลายเดือนก่อน +5

      if you want to get into low-level systems programming, absolutely. learning zig will also make the transition to learning C much easier.

    • @nathanfranck5822
      @nathanfranck5822 5 หลายเดือนก่อน +6

      Zig is fun and the community is cool. Worst thing as a beginner's language is just the basic difficulty typing .what = .{ .thing = .etc } a bunch
      Kinda the antithesis to python that way...

    • @s0laret012
      @s0laret012 5 หลายเดือนก่อน +6

      It is, but i wouldn't learn it as a first language.
      Don't get me wrong, Zig is my *favourite* language, but i think as a first language you should learn something stable with a good foundation (I started with C++, and would always not recommend it, but instead i'd recommend C.)

    • @poggarzz
      @poggarzz 5 หลายเดือนก่อน

      @@not_kode_kun one more thing to consider is the available resources to learn the language. C/C++ being older language seems to have an advantage over zig on this matter. So, maybe learning C/C++ to get familiar with low level stuff and switching would be much easier, no?

    • @fourbytes1
      @fourbytes1 5 หลายเดือนก่อน

      @@s0laret012 Thanks for the recommendation!
      I've already tried Rust and I found it comparable to climbing Mt. Everest one way. 😀

  • @mrlectus
    @mrlectus 5 หลายเดือนก่อน +1

    I don't like the syntax, i prefer rust syntax

  • @PouriyaJamshidi
    @PouriyaJamshidi 5 หลายเดือนก่อน +13

    Nim is also a system's programming language with optional GC

  • @perfectionbox
    @perfectionbox 4 หลายเดือนก่อน +2

    In an epic confrontation, Zig and Rust battle for dominance while most developers ignore them and continue using C++ 🤣

  • @hwstar9416
    @hwstar9416 5 หลายเดือนก่อน +4

    the whole argument that you shouldn't learn C because it's unsafe is silly. You have to know what modern compilers do for you, learn C.

  • @nobrainnogame4320
    @nobrainnogame4320 4 ชั่วโมงที่ผ่านมา

    Have been testing Zig for a few week in the context malware dev, I think I might share my thought on the language so far:
    What I like:
    1) Very good interoperability with C (don't need to write binding, the compiler will parse your C code and generate the binding automatically, it's almost seamless)
    2) No JIT compilation GC, hidden control flow
    3) explicit allocator argument convention for function that return dynamically allocated memory: it makes these functions stand out like sore thumbs immediately.
    4) defer: pretty cool to be able to be able to associate the memory allocation and release next to each other
    5) comptime: well still feel a bit unnatural due to the comptime limitations but it's much better than macro kung-fu
    6) error handling: early try return + defer really make your code clean: no more ugly nested "if", goto or do{ ... break; }while(0) to release resources
    7) generate fast and small binaries
    What I disliked:
    1) array/slice type syntax is a bit of a mess and pretty confusing between [_]type, [n]type, [n:0]type and [*]type
    2) array/slice type coercion is confusing
    3) No interface support (yet?): you have to hack union or implement your vtable manually
    4) The std is a bit lacking in some areas (the Windows OS API mappings are lacking )
    Other concerns are: the lack of documentation, and regular breaking changes but it's probably to expected from a still unstable language.
    Overall , a very good language that still need a good amount of polish but that has potential to appeal to many systems developers

  • @notapplicable7292
    @notapplicable7292 5 หลายเดือนก่อน +5

    Zig is enjoyable, rust is not. Then again, C++ is very enjoyable for me so maybe im just broken.

    • @smoked-old-fashioned-hh7lo
      @smoked-old-fashioned-hh7lo 4 หลายเดือนก่อน +2

      i don't think rust is inherently not enjoyable. there is quite a large crowd that enjoys using it. it's just that it's so different that a lot of people feel intimidated and also humbled. zig is more familiar and people associate familiarity with good.

  • @hwstar9416
    @hwstar9416 5 หลายเดือนก่อน +1

    C has sanitizers that catch out of bounds errors and the like. Why don't you talk about them?

    • @Hexanitrobenzene
      @Hexanitrobenzene 4 หลายเดือนก่อน

      Yeah, but that's a non-official hack on top of it.

  • @nyx211
    @nyx211 5 หลายเดือนก่อน +9

    Is it just me or does it seem like Zig's syntax is weird for no reason? At 6:24 he mentions how you can think of running the openFile() function as going left or right. When you go left, the success result is put into f, but when you go right you catch the error value. So then why is the return type std.fs.File.OpenError!std.fs.File. Why is the right on the left and the left on the right?

  • @ИванЗакутний-м3ц
    @ИванЗакутний-м3ц 5 หลายเดือนก่อน +2

    rust lives matter

  • @HaydenGray
    @HaydenGray 5 หลายเดือนก่อน +13

    As much as I wanted to like Zig and use it as a C replacement I just couldn't. I found that it added "too much" to the language and had overly verbose syntax (I would rather just use Rust at that point). When I compared it to Odin, I found that Odin was just simpler overall while still giving the benefits that Zig has (no hidden allocations/manual allocators, range-based iteration, sized arrays, better error handling, etc). Zig definitely has a lot more momentum behind it now with the release of tools like Bun but I would really like the ecosystem with the better tooling (especially the LSP), MUCH simpler syntax, builtin linear algebra, and a style that feels like what C++ *should* have been to take off

    • @ovi1326
      @ovi1326 5 หลายเดือนก่อน +1

      Actually there are some great podcast episodes between Andrew Kelley and G
      gingerBill where they both explain their rationales for doing things the way they do them.
      I like zig way more for comptime stuff, more explicitness in both the stdlib and the lang itself and most importantly @cImport

    • @stretch8390
      @stretch8390 5 หลายเดือนก่อน

      Can you elaborate on the simpler syntax? I found it difficult because I am a beginner who never had to consider things like memory and static types before (lol), but I personally didn't find the syntax difficult.

    • @HaydenGray
      @HaydenGray 5 หลายเดือนก่อน

      @@stretch8390 I wouldn't call it "difficult" but more just... odd (i.e. the "for" loop syntax). There wasn't a single thing that really killed it for me, it was more just death by a thousand paper cuts that made it kind of unpleasant to write (having to do error handling for writing to stdout without using the debug print for example). I'm sure things will change as the language evolves but having to do stuff like: ` try std.io.getStdErr().writer().print("Hello {s}!
      ", .{"foo"});` (which also requires the function to be marked with "!" which is quite a leaky abstraction) vs `fmt.eprintfln("Hello {}!", "foo")` to log to stderr without using the debug functions is just unpleasant to me. At that point, I think we cross the "simple language" barrier and I would rather just use Rust at that point

  • @Alexander_Sannikov
    @Alexander_Sannikov 3 หลายเดือนก่อน

    > we're not gonna talk about C++
    > 90% of the gamedev industry proceeds to use C++

  • @brandonphilander661
    @brandonphilander661 3 หลายเดือนก่อน +3

    I really like Odin.

    • @SashaMogus
      @SashaMogus 2 หลายเดือนก่อน +1

      Same

    • @0z25y
      @0z25y หลายเดือนก่อน

      @@SashaMogus What feature makes you like odin more than zig's explicity?

    • @SashaMogus
      @SashaMogus หลายเดือนก่อน

      ​@@0z25y Well, I can list a few features I like(array programming, vendor libraries etc.)
      but what I like the most is just the sheer simplicity of the language.
      Odin looks simpler and more straight forward to read in my opinion.

    • @0z25y
      @0z25y หลายเดือนก่อน

      @SashaMogus seems like we can focus on games instead of syntax stuff not like C/C++

  • @ClaymorePT
    @ClaymorePT 2 ชั่วโมงที่ผ่านมา

    I don't see the point of explicitly tell the compiler to run the deallocation code using defer at the end of the function execution.
    Why not have the compiler do that automatically for each allocation, unless an explicit statement tells the compiler to not do that if the programmer wants the deallocation to be done elsewhere?

  • @jonathanh.7907
    @jonathanh.7907 5 หลายเดือนก่อน +9

    ZIG ONTOP!

    • @xaxfixho
      @xaxfixho 5 หลายเดือนก่อน +1

      U power bottle 🍼 🤪 om

  • @aeiou3701
    @aeiou3701 5 หลายเดือนก่อน +15

    seeing people say whatever about c++ most of the time makes me think whats wrong with my car cause i like it

  • @kenneth_romero
    @kenneth_romero 5 หลายเดือนก่อน +2

    can you change code theme when presenting? that red text is hard to see on the background color. at least for me since i'm a bit colorblind

  • @SuperMixedd
    @SuperMixedd 5 หลายเดือนก่อน +2

    I am reasonably good with C but not with C++ and I was wondering if I should rather a) hone my C++ or b) learn Rust

    • @MikkoRantalainen
      @MikkoRantalainen 4 หลายเดือนก่อน

      I'd recommend learning Rust first and then C++ if you still feel like it. C++ is very complex language and doesn't provide much value over Rust in my opinion. C++ does allow writing high performing code but it also hands you invisible shotgun with a hair trigger which makes it really easy to blow your foot off.
      With C++ you can have identical looking code that fails to handle errors and code that does handle errors. With exceptions, the calling code may look identical (identical source code at binary level!) but one variant fails to handle errors correctly.
      With Zig and Rust, the error handling is always visible. With idiomatic Rust, you use Result enums and mark possibly failing function call explicitly with single character "?" and otherwise the code can match the C++ version. This extra explicit "?" character makes all the difference. That clearly marks all the locations in the code that can potentially fail but do not pollute the code any further if you don't need extra processing but logically rethrow the error out of your function.
      However, Rust forces you to always handle data ownership and lifetimes which may be quite hard to get right at first, especially if you're trying to re-implement some algorithm that doesn't directly map to these concepts.

    • @roiqk
      @roiqk 3 หลายเดือนก่อน +1

      I think that no one ever regrets learning anything. I would go with C++.

    • @MikkoRantalainen
      @MikkoRantalainen 3 หลายเดือนก่อน

      @@roiqk I agree that learning is always good, too, but I'd recommend starting with Rust if you don't know C++ nor Rust.
      Historically C++ has been the language to know but it's really complex language and still cannot provide many of the nice features that Rust has and both have nearly identical runtime performance.

    • @roiqk
      @roiqk 3 หลายเดือนก่อน +2

      @@MikkoRantalainen C++ logic is used in many languages. Rusts borrow system is unique and the skill is not transferable to other languages. Thus he will need to learn it at some point anyway.

    • @MikkoRantalainen
      @MikkoRantalainen 3 หลายเดือนก่อน

      @@roiqk My opinion is that you have to *think* about the same thing that Rust borrow system does automatically while you program in many other non-managed languages.
      When you understand how Rust works, you can understand the same idea in well written C and C++ programs, too. Except the compiler doesn't help even a bit in case of C and C++.

  • @adicide9070
    @adicide9070 5 หลายเดือนก่อน +11

    yo cpp ain't systems level now? :D

  • @Lorne_at_work
    @Lorne_at_work 5 หลายเดือนก่อน +2

    Great video, I was just about to start my zig journey when I came across Odin. It's my first foray into low level/manual memory management and it's been really fun so far. I'd love to hear your thoughts on Odin as well.

  • @Qohist
    @Qohist 5 หลายเดือนก่อน +31

    the linux kernel should have adapted zig instead of rust

    • @zokalyx
      @zokalyx 5 หลายเดือนก่อน +7

      yes! zig is literally intended to be just C but better, unlike Rust which has "bloat" (don't kill me pls I still love Rust)

    • @tiedye001
      @tiedye001 5 หลายเดือนก่อน +21

      Zig is still unstable

    • @nyanlauncher7350
      @nyanlauncher7350 5 หลายเดือนก่อน +2

      I don't know much about it, but I'm pretty sure the reasons behind it were: Zig is much less mature than Rust (especially when they started implementing Rust), Not nearly as popular, and has much better C(++) interop that Rust.

    • @lauraprates8764
      @lauraprates8764 5 หลายเดือนก่อน +2

      Well, zig is far from a 1.0, it doesn't have a GCC implementation, while rust is more stable and have a GCC implementation, the most important thing is the GCC implementation, the Kernel is meant to be compiled with GCC, compiling it with Clang is suboptimal and I don't even know if it's possible to do, compiling with Zig's C compiler is even worse

    • @monad_tcp
      @monad_tcp 5 หลายเดือนก่อน

      the real problem with the linux kernel is that you still need the stupid GCC compiler and a lot of GNUisms to compile it, you can't just use the LLVM toolchain, which all modern tooling is built on top off.