Prime Reacts: Is This NEW Language BETTER Than Rust? C++? (Zig First Impressions)

Поделиться
HTML-код
  • Опубликовано: 27 дек 2024
  • Recorded live on twitch, GET IN
    / theprimeagen
    MY MAIN YT CHANNEL: Has well edited engineering videos
    / theprimeagen
    Discord
    / discord

Комментарии • 760

  • @ThePrimeTimeagen
    @ThePrimeTimeagen  Год назад +85

    GO SUB TO LLL!!!
    Original: ruclips.net/video/zFELcHTki9U/видео.html
    Author: www.youtube.com/@LowLevelLearning

    • @LowLevelTV
      @LowLevelTV Год назад +14

    • @LoftwahTheBeatsmiff
      @LoftwahTheBeatsmiff Год назад +1

      Subbed cheers

    • @RogerBarraud
      @RogerBarraud Год назад

      Already was 🙂

    • @alienews0
      @alienews0 8 месяцев назад

      1:00 might be possible that your editor does weird sh*t if it wasn't coded in the best language ever : c++
      No ok seriously i know rust is better but stop hurting old guys' (like me) feelings : when i studied coding, cpp was the best language around.

  • @theondono
    @theondono Год назад +973

    No beeping while saying “C*+”? I thought this was a family friendly channel..

    • @soulofangel1990
      @soulofangel1990 Год назад +53

      yeah, that was a C*+ move from the Primeagen

    • @KeyError
      @KeyError Год назад +14

      C*+? … oh no I made it worse

    • @samanthaqiu3416
      @samanthaqiu3416 Год назад

      fuck you and wait for it..
      no beep, huh

    • @CoreDump451
      @CoreDump451 Год назад +10

      I for one am shocked.

    • @guitarcat01
      @guitarcat01 Год назад +9

      Why would he say C pointer plus?

  • @costelinha1867
    @costelinha1867 Год назад +605

    I'm still waiting for someone to make a language called Zag, so the cycle becomes complete.

    • @eshwarprasad524
      @eshwarprasad524 Год назад +170

      Zig for Backend
      Zag for Frontend

    • @nicowong2428
      @nicowong2428 Год назад +73

      @@eshwarprasad524 dude i would switch to full-stack if we got this.

    • @LoveLearnShareGrow
      @LoveLearnShareGrow Год назад +17

      I WANNA REALLY REALLY REALLY WANNA ZIG A ZIG - AH!

    • @RenderingUser
      @RenderingUser Год назад +17

      if that isnt the name of the upcoming package manager for zig, i aint using the language

    • @O...Maiden...O
      @O...Maiden...O Год назад +2

      zig and sharko, not zag :)

  • @AK-vx4dy
    @AK-vx4dy Год назад +162

    Zig is clearly to replace simple pure C on embedded systems or DIY projects. It's clearly safer so less frustrating to beginner.

    • @homelessrobot
      @homelessrobot Год назад +2

      no. at least to the first. While it is fine in embedded systems and DIY projects, its clearly meant for general purpose usage. Also, pure c? Vs what? Mixed language projects?

    • @AK-vx4dy
      @AK-vx4dy Год назад +12

      @@homelessrobot I wanted to say that Zig is not 1:1 C++ replacement.

    • @homelessrobot
      @homelessrobot Год назад

      @@AK-vx4dy OK, i see.

    • @AK-vx4dy
      @AK-vx4dy 10 месяцев назад +4

      @@SimonWoodburyForget Right. But Rust let you build guard rails for entire teams even in lowlevel language.

    • @TheSulross
      @TheSulross 7 месяцев назад +2

      But what can you say about a dude that rattles off Carbon - passing it off as though its a viable choice for today's professional working programmers?
      Carbon is years away from reaching that kind of viable mainstream status.
      From the get go I visibly watched as the analog credibility meter flatlined as soon as the AI engine parsed and analized that sentence.
      It even activated the seldom-heard Star Trek red alert alarm. Had to enter that special code that is normally only used to stand down ready-to-launch ICBMs to get that alarm turned off.

  • @anderdrache8504
    @anderdrache8504 Год назад +344

    I also prefer Rust over Zig but I think it's very interesting, so to address some of your concerns:
    - Zig will get a Package Manager and the Lead Developer Andrew Kelley was live streaming development on it just a few days ago
    - Zig is null safe, pointers can't be null by default and nullable types have to be null-checked before you can use them (almost the same as Rust Options)
    - You agreed on "no hidden control flow", but once you realize that this means that Zig doesn't have destructors, you might disagree :)
    - Don't be too mad about undefined, it just means "uninitialized" and will be caught when used incorrectly in debug builds (Rust also has this with mem::uninitialized)
    - Zig basically has Rust-like enums with union(enum), they work almost exactly the same and you will have to switch on them to access the data like in Rust
    Overall I think that Rust has many more use cases but we shouldn't say that it will "win", since Zig also has it's niche and it's a very interesting language.

    • @diadetediotedio6918
      @diadetediotedio6918 Год назад +30

      Rust still wins in the sense that the entire construct of the borrow checker is also to prevent many problems related to racing conditions and memory leaks, in Zig you just can't have many of these guarantees. But surely, Zig is indeed an interesting language, I just hope it's fanbase didn't turn into another C++-like toxic community

    • @ScibbieGames
      @ScibbieGames Год назад +68

      @@diadetediotedio6918 The borrow checker simply does not work in low level environments and graphics programming. Undefined behavior is all over the place in the embedded space. By giving those guarantees, it makes it harder and very difficult to interact with the C ABI at all.

    • @fiona9891
      @fiona9891 Год назад +14

      @@ScibbieGames an argument for using both of them in different situations.

    • @diadetediotedio6918
      @diadetediotedio6918 Год назад

      @@ScibbieGames
      This is simply a lie, take a look on Asahi Lina commentaries on Rust utilities for driver development for an interesting example

    • @erickmoya1401
      @erickmoya1401 Год назад +4

      Handling memory correctly without handling it is what makes it great from the beginning for me. If someone copies it and improves in other things I am in.

  • @QberryShortcake
    @QberryShortcake Год назад +27

    Apparently C++ is why, but the guy who picked the name "vector" didn't realize what it meant in math.
    And now everyone does it.

    • @testtest-qm7cj
      @testtest-qm7cj 10 месяцев назад

      Scheme, Common Lisp -> C++, Java -> everyone else

    • @QberryShortcake
      @QberryShortcake 10 месяцев назад

      @@testtest-qm7cj what

    • @testtest-qm7cj
      @testtest-qm7cj 10 месяцев назад +6

      @@QberryShortcake Alexander Stepanov and Daniel Rose, "From Mathematics to Generic Programming"
      The name vector in STL was taken from the earlier programming languages Scheme and Common Lisp.

    • @Pabloparsil
      @Pabloparsil 9 месяцев назад

      In Zig I think they just run out of names. They have arrays, arrayList and wanted something for the SIMD stuff and had to go with Vector

    • @QberryShortcake
      @QberryShortcake 9 месяцев назад +1

      @@PabloparsilVector for SIMD actually makes sense to me

  • @bloody_albatross
    @bloody_albatross Год назад +24

    libc is bloated? I just looked it up, yes under Linux Zig directly does sys calls without libc! But most other programming languages (like Rust) still link libc as a kind of system call abstraction layer. libc is a really small standard library. It doesn't even provide a hash table (unless that changed recently). Software bloat comes from shipping a full browser engine with your software (Electron), not from linking libc!

    • @TheSulross
      @TheSulross 7 месяцев назад +1

      the nasty thing about clib is that the C APIs it defines are versioned even at a linker level. So it's incredibly easy to write a program that binds with libc, using a latest compiler and latest Linux distro, then find your program won't run on other distros that are just a matter of a fewvyears old - even though there is no semantic change that would break the working of your program, and at the C language level the API signatures remain exactly the same.
      It's way overly tedious to try and work around this libc versioning crap.
      One thing I appreciate about Go is that there is a like ability to build a Go program to where it doesn't bind to libc at all.
      If it was easy to opt out of the stringent version binding on libc APIs I wouldn't mind it, but it's a too much of a mess to cope with.

    • @bloody_albatross
      @bloody_albatross 7 месяцев назад +1

      @@TheSulross That's true and was actually a reason why I linked an otherwise standalone (Rust!) binary with musl instead of glibc once. But that's a glibc issue, not a general libc issue. But granted, it's effectively the same. Though I wouldn't call it a bloat issue, but a versioning issue. But that's now splitting hairs.

  • @Jplaysterraria
    @Jplaysterraria Год назад +85

    I wouldn't say Rust was easy to learn for me, but it made sense:
    I came to Rust with mostly C/Java/Python knowledge and I kept struggling with mutability in Java/Python, and C just being hard to get right/having to reimplement basic data structures all the time.
    With that background, I wanted something that dealt better with mutability than Java/Python, and something which wasn't as involved as C/C++ to get dependecies working, for that, Rust is the perfect midpoint (even though it's closer to C/C++ than Java/Python).

    • @ghosthunter0950
      @ghosthunter0950 Год назад +4

      With c specifically I just keep important pieces of my previous code around to reuse in different programs like data structures, and you gain knowledge and experience implementing them at least once in your life, although it's not that necessary I still like it.

    • @Jplaysterraria
      @Jplaysterraria Год назад +15

      @@ghosthunter0950 I do implement data structures for fun, but I'd rather use a battle tested data structure than whatever I come up with for actual code.

    • @radinkhosraviani8634
      @radinkhosraviani8634 Год назад +3

      Have you tried golang? I’m tearing myself apart on what to learn. I only know the basics of python and basics of javascript

    • @SemiMono
      @SemiMono Год назад +1

      @@radinkhosraviani8634 learning go isn't a bad move, largely because it's a pretty small investment compared to something like rust or C++. It's easy to get productive quickly. It'd probably be a good place for you to start with statically typed languages.

    • @homelessrobot
      @homelessrobot Год назад +2

      @@Jplaysterraria this however doesn't suggest that its the language's job to make this possible. There are plenty of data structure libraries for c. Use one.

  • @eagle2com
    @eagle2com Год назад +17

    A vector in Zig is actually a type intended for SIMD operations, not a dynamic array.

    • @TheSulross
      @TheSulross 7 месяцев назад

      I have this program that built for a large telcom company that uses the Intel DPDK library to replace the kernel networking stack and takes over complete management of a specified ethernet interface. DPDK is written entirely in C.
      DPDK also isvrather primitive in that one works with it by reading and writing entire raw packet via RX/TX port. There is no high level Berkley networking stack sitting atop that (though there are projects that graft such on). In my case I justbneed to support UDP transport but I still wanted a socket abstraction for dealing with different traffic sessions, so I heavily modified the UDPDK library to provide that - it too is all C.
      So everyone is familiar with Linux epoll vs POSIX poll. I needed to add such an API to UDPDK.
      Well, epoll is superior to poll and can scale to tens of thousands - perhaps overbhundred thousand concurrent socket sessions. The poll API tops out at level of a thousand to few thousand sessions. epoll is probably at least ten times more efficient if not more.
      However, implementing epoll is complex - implementing poll is simple. Naturally I implemented POSIX poll.
      The performance is good to up to a thousand and perhaps acceptable to around 4 thousand. This is considered okay as get a huge boost in network traffic throughput from DPDK. And this will be deployed in K8 and sonwill be load balanced clustered - need more session capacity then launch another container instance.
      But if I redesign the poll call data structure to be data oriented - like Zig does its containers, and use SIMD to do the poll processing, I would automatically make the scaling of my poll API 8 times greater. Scaling to 20 to 30 thousand concurrent socket-based traffic sessions would be a wonderful win.
      There is even talk of support for SIMD in C++ 26
      But gcc has intrinsics for doing this too - which will be what I use. But a language that could directly support this would be kind of cool.

  • @StingSting844
    @StingSting844 Год назад +42

    The dog itching sound was so funny 😁
    Btw one of the most hyped projects written in Zig is Bun by Jared Sumner and when i tried it the first time I got a segmentation fault 🤷‍♂️

  • @biggiefrosty
    @biggiefrosty Год назад +17

    Zig vectors are vectors like vec3 and vec4, used for easy SIMD. The growable array is a std.ArrayList 🎉

  • @IanRiley915
    @IanRiley915 Год назад +18

    I really enjoyed these takes. I'm an instructor who teaches programming, algorithms, data structures, etc. to high school and college students. I've given Rust serious consideration time and time again as a first language for these students. I also go back and forth on the issue. You have many separate camps, which makes it a difficult question. You have students ages 12-18, students ages 18+, and those that are self-taught at home of various ages. The question of what to learn first or even second heavily depends on which camp you're in and also what country you live in. For students, Rust could be a good first or second language. At least at this time, Zig would not be. I could see a language like Zig in the future with the same philosophies being a good candidate for teaching programming to students, but as it stands right now, it's maybe a third language, maybe.

    • @Dazza_Doo
      @Dazza_Doo Год назад

      I would say that Rust is a great language for newbies. I say this after I have struggled with C (and it's variants for decades). Rust forces you to think about Data, who owns it and who can borrow it. There is additional thought about Rust that you need, instead of code and debug, refactor and debug. Sure debugging is a fact of life, however I want to feel like I'm learning something and the Rust Analyser and Cargo Checker do a great job. If you ask a Python programmer what is the Heap, they may look at you and blink, with Rust you learn more about what's going on under the hood, just by declaring a variable for an integer addition. I like the fact that you deploy rust on Microcontrollers (that anyone can buy and play with) and they also create Web interfaces with it. I think it will be the swiss-army knife of programming. I've heard that Zig is the C replacement and Rust is the Cpp replacement, but I don't know.

    • @Yupppi
      @Yupppi Год назад +5

      Rust would be cool if the teacher was really focused on individual support and explained things really well, because it feels like a tough language where you really need to know quite a few "whys" to get things come right when you write it. It's not forgiving and it drives me mad when it feels like every implementation has different syntax rules to compile, any detail you change breaks it until you figure out that the rules have changed. But then again, with good teaching it might work nicely, especially if the student didn't have experience that directs them to wrong conclusions. That in my opinion is equally difficult about Rust like Primeagen said too.

    • @logicaestrex2278
      @logicaestrex2278 6 месяцев назад +1

      Lisp. That simple.

  • @a_commenter
    @a_commenter Год назад +5

    12:30 My main rule for unit tests is that I'll write them if, when writing a function, I go "wait will this be an off-by-one error?"

  • @thfsilvab
    @thfsilvab Год назад +44

    The test declaration syntax is just beautiful, would love something like that in Rust instead of marking everything with attributes, also having test names as strings, just gorgeous

    • @inkryption3386
      @inkryption3386 Год назад +1

      You can also use local declarations in place of a string, to signal you're specifically testing it. E.g.
      fn parseInt(bytes: []const u8) u32 {...}
      test parseInt {
      // -- test the function --
      }
      which is really nice

    • @stevenhe3462
      @stevenhe3462 Год назад

      Elixir also has this, but it's a macro.

  • @minikame2272
    @minikame2272 Год назад +66

    Prime: "I'm tired, need a small rest."
    *Spends the next week publishing more videos than there are days.*
    Go to the Bahamas without your laptop or something or imma break in and shave your face in your sleep

    • @rodrigolj
      @rodrigolj Год назад +5

      >implying he sleeps

    • @seancpp
      @seancpp Год назад

      He livestreams then an editor goes in and chops out individual videos from it

    • @Hardcore_Remixer
      @Hardcore_Remixer 9 месяцев назад

      You got a Segfault when you dereferenced his unallocated sleep variable.

    • @Kane0123
      @Kane0123 8 месяцев назад

      This is such an interesting mix of anger and loving sentiment.

    • @TheSulross
      @TheSulross 7 месяцев назад

      it's essential to ditch the smart phone to have anything resembling a true vacation break
      people should just go to Walmart and get a $30 simple, calls/sms-only burner phone - then only allow significant others to have its phone number, and take only that phone on vacations.

  • @andrewtran9870
    @andrewtran9870 8 месяцев назад +4

    24:50 Honestly, as a 3rd year software engineering student who learnt Rust, I agree that what makes it difficult for many, is how different it is from other languages. But the concepts themselves aren't actually that difficult, they're just new. I would almost liken it to learning a new programming paradigm.
    So being someone who is still learning, and hasn't necessarily gotten stuck in doing things the ways I've always done them, I haven't found Rust that difficult to learn. That being said, I haven't made any super complex projects with Rust yet.
    But so far I tend to like it much more than C++. Managing memory and pointers in C++ seems error prone the moment a system no longer fits within your cognitive load.

  • @danielcoats713
    @danielcoats713 Год назад +7

    As a C# programmer, off the rip the sentiments expressed after hearing "no hidden control flow" is felt. That's actually the main reason why I suggest Rust to C# programmers.

  • @vishwanathbondugula4593
    @vishwanathbondugula4593 Год назад +6

    You can avoid segfaults by not adding \0 by just initializing your buffer to \0s initially (using something like bzero or my fav memset(buf, '\0', sizeof(buff))) and then once you copy your chars to that array / buffer you don't have to explicitly put a \0 at then end since the memory is already filled with \0s and you are overwriting them with whatever you want given you don't overflow the buffer.

  • @jakejakeboom
    @jakejakeboom Год назад +8

    libc is optional, if you’re doing embedded programming in C then you should know exactly what you’re linking in, what your trap table looks like, your entry point, and everything that happens in your boot loader to set up your stack and whatnot. These things are not inherent to C, and they are pretty much all configurable. I don’t see how Zig would be any different, but I’m happy to be corrected.

    • @TheSulross
      @TheSulross 7 месяцев назад

      and even doing Linux specific programming, libc is a huge pain in the arse because of it's versioning of its APIs. What one builds on a late model distro, binding to its versions, can then end up not being able to run on customer distros that are just a few years old (Canonical sells pro support for LTS releases that can go out to 12 years).
      It's a pain to try and opt out of that and buildvreleases thatbare capable of running on older releases while doing so using the latest in distros and compiler releases.
      Zig has taken on a righteous battle indeed in attempting to solve the infamous libc problem.
      Linux libc tyranny is straight from the pits of Hell.

  • @prgnify
    @prgnify Год назад +70

    I have some input on the "first language to learn" thing. I think Prime gets the point perfectly, if Rust is your first language, you learn it once and learn it right - all while the language itself teaches you - the rust compiler not only teaches you the language but also teaches you programming as a whole.

    • @andrewdunbar828
      @andrewdunbar828 Год назад +48

      There's a lot more chance you'll give up on programming though when you're new and only see a huge wall and the benefits are only going to be visible after you scale the wall. I've seen people give up on easier languages who I know would be able to program.

    • @Evan490BC
      @Evan490BC Год назад +23

      I like Rust. But it doesn't teach you "programming as a whole". It teaches you imperative programming with a dash of functional.

    • @Zubbbz
      @Zubbbz Год назад

      This has 100% been my experience while learning programming. Most of my knowledge has been learned while I have been learning rust and it actually tells you the issue which is so nice.

    • @jordixboy
      @jordixboy Год назад +3

      @@andrewdunbar828everyone is able to program with enough time and effort put in. Programming is nothing special and you dont need to be a genius for it. Its just effort and time, like anything really.

    • @zeyonaut
      @zeyonaut Год назад

      @@andrewdunbar828 I don't think the wall is anywhere near as huge as that for C++. I learned C++ as a kid and struggled with it for years; its surface area is insanely massive with difficulties everywhere, for any newcomer. I strongly believe I would have had a far easier time learning Rust had it been as mature as it is now back then. It's built around the same principle, lifetime-based resource management, but is the conceptually simpler language by far, with an easier ecosystem of tools and packages to use.

  • @n4bb12
    @n4bb12 Год назад +22

    I love unit testing, it saves me so much time.

  • @UliTroyo
    @UliTroyo Год назад +24

    I love Zig, and I think it’s one of those things where you either gravitate toward it or Rust.

    • @Gordolone
      @Gordolone Год назад +3

      Totally agree. I really love Zig. I feel more comfortable with it than Rust. But this preference does not mean Rust is shit for me. I like seeing Rust used but I don’t like using it in first person 😅

    • @PwrXenon
      @PwrXenon Год назад +4

      I’d pick rust, zig feel like some offshoot c replacement

    • @etodemerzel2627
      @etodemerzel2627 Год назад +7

      Zig is really nice to use. Very simple and straightforward, yet very powerful.

    • @PwrXenon
      @PwrXenon Год назад +5

      @@etodemerzel2627 I don't doubt that, its just that If i'm going to invest my time into a language it needs to have some staying power, C isn't going anywhere but rust will with time take over C++'s edge and has been growing alot and devs love it.

    • @andrewdunbar828
      @andrewdunbar828 Год назад

      I like Zig and Rust, but I'm not actually productive these days so maybe that's moot. I have noticed a few other people who like both though and they tend to be the types that are not language fanboys and are not prone to attacks and hyperbole, etc.

  • @alexey104
    @alexey104 Год назад +4

    2:10 > "If this function throws, which function is going to catch it above you?"
    But if this function just fails returning some error code, which function is going to handle it, if any at all?

    • @AloisMahdal
      @AloisMahdal 9 месяцев назад +1

      I had a similar thought about that part.
      I think Zig's model is still better, though, because you can't start throwing errors without obviously changing the signature of the function. If a function returns error, caller simply must deal with it, if only to pass it on. And compiler's going to know which errors could be returned from a given function so it can track it for you and make you deal with it at some moment. I think you can do similar things with try/catch handling but in Zig it's just cleaner, all is there in plain sight.

  • @frydac
    @frydac Год назад +11

    I've done a lot of C and I try to use it as little as possible. The thing is that you only use C where you absolutely have to. 2 such usecases are languague interop (zig can maybe be used here if it also is compatible with the C ABI, I don't know), and embedded platforms that only have a gcc based compiler that only supports C properly. Which is the biggest usecase for me and thus zig will probably never do that, and I think it will take some time before those platforms don't exist anymore and everything supports llvm based compilers. So in those usecases zig is just not competing and C remains the only viable option, and in the other usecases it is competing with C++ and Rust and imho not really with C, and then I don't really see it gain a lot of traction, but who knows.

    • @Sindrijo
      @Sindrijo Год назад +4

      One of the primary use cases for Zig is exporting a library with the C ABI for other programming languages to call into.

  • @Iscream4j0y
    @Iscream4j0y 9 месяцев назад +3

    I test things to make sure they work the way I think they do, like I write code, and I write my tests to make sure it works specifically the way I wrote it, I attempt to strongly type all the values, and I write counter tests to make sure that it's not returning results when it shouldn't. I've been so tired of thinking that it works the way I intended and instead KNOW that it works the way I intended

  • @dyslexicsteak897
    @dyslexicsteak897 Год назад +14

    Zig is an ultra mini ultra simple ultra clear language and I don't think it can even be compared.

    • @Br4dButt0wski
      @Br4dButt0wski Год назад +2

      Odin is simpler and clearer than Zig

    • @lugaidster
      @lugaidster 8 месяцев назад

      ​@@Br4dButt0wskito me you can only call a programming language "system's programming language" of it supports freestanding targets.

  • @mario7501
    @mario7501 Год назад +51

    I would say C should be the first language for most people. Especially if you do a CS degree. It just teaches you so much about how computers work and you'll appreciate why rust's borrow checker is so amazing.

    • @waldtrautwald8499
      @waldtrautwald8499 Год назад +28

      While I do agree that every programmer should learn C at some point, I don't think it's a great first language. As a beginner, thinking algorithmically is already hard enough. Adding all the complications a low-level language like C brings doesn't lead to a great learning experience imo.

    • @shimadabr
      @shimadabr Год назад +5

      ​@@waldtrautwald8499 That's the thing though. It depends on what you want to learn. For a CS student, C brings a lot of value because it teaches a lot about low-level aspects of the computer. What better moment to learn it than at that moment? It's useful when learning operating systems, networks, computer graphics, etc. But it's true that when you're studying these subjects, including data structures and Algorithms it can be an obstacle to manage it's dirty aspects while trying to learn the fundamentals of what you're studying.
      As for a self-taught developer/student it's better to start with something more "tangible" imo. Because you want to enter the market as fast as possible and trying to understand all the aspects of computing that C can help expose is time consuming.

    • @0xDEAD_Inside
      @0xDEAD_Inside Год назад +7

      During my final exams in college, a girl beside me literally cried with head on the desk because she got segfault in her linked list implementation and she couldn't find the source.

    • @shimadabr
      @shimadabr Год назад +3

      @@0xDEAD_Inside lol that's a little extreme 😂. I imagine she was unded a lot of stress and this was the final straw.

    • @0xDEAD_Inside
      @0xDEAD_Inside Год назад +4

      @@shimadabr Yeah! She was a straight A student and segfaults are back breakers even for experienced programmers.

  • @rumplstiltztinkerstein
    @rumplstiltztinkerstein Год назад +55

    I think that "Rust is a hard language" is not the best way to describe the experience with it. I would think that the best way to describe it, to someone that haven't used it, is that "Rust is a language that is slower to implement". The language requires us to focus on way more details than other languages. We have to think about the way memory is managed. We have to think about the compiler.
    Ownership, pointers, traits and generics. That is rough to get started. I think that new developers should be given the option: "Do you want to learn a language that will allow you to spend a short time coding and a long time debugging, or a language that takes a long time coding and almost no time debugging?"

    • @AlexanderHyll
      @AlexanderHyll Год назад +13

      With respect to everyones opinion and this being to some degree subjective, I don’t agree that Rust is slower to implement after you know it well, but is indeed harder to learn to that extent as a programmer. The Rust language is generally not more verbose than other systems programming languages, but it takes longer to get to the point that you write code that just compiles first try. At least that’s my 2 cents after 4 years professionally coding in rust. Rust has more concepts you need to master than most programming languages, but really isnt that slow to implement 98% of the time (ofc comparing to C(with variants)/Java etc).

    • @rumplstiltztinkerstein
      @rumplstiltztinkerstein Год назад +2

      @@AlexanderHyll I kind of agree with your point. But I have trouble when it comes to learning new crates. Sometimes we have to go deep into the type system to find out what returns what. It gets a lot easier with practice, but messing around with the type system can be rough.

    • @khhnator
      @khhnator Год назад +2

      rust is complex, it is declarative by design. it won't wipe your ass, you have to ask for it
      its slow language to master just because there is much to learn
      the time you spend to get the first build of your program that does "something" even if not properly. is slower than other languages. a lot slower in fact.
      but time to deliver a program however is faster than comparable languages. a LOT faster. just because there is less debugging time. and usually ends with something that at least feels a lot more reliable.
      and that seems like that's why everyone ends loving rust. there is that period when you are halfway thru development when each new problem that emerges seems to get worse than the previous one. and you feel like just tossing the whole codebase in the garbage and starting again.
      while in rust the experience is the opposite, not only you have less problems in general as most things **just works** even against our best intuition while the complexity of the issues don't escalate.

    • @MrTeathyme
      @MrTeathyme Год назад +3

      rust is insanely fast to implement once youve learned it
      Almost all the features of the borrow checker that slow you down can be bypassed.
      Need to quickly whip up something and dont want to have to deal with keeping track of mutable references etc? .clone() everywhere, itl run like ass and its unclean as fuck, but if youre whipping something up quickly as a PoC you dont care about that anyway.
      Thats ownership dealt with.
      Traits you straight up dont even need to touch for 80% of what you can do in rust, you only really start touching traits as an implementation detail, which again isnt relevant for PoC's
      Generics are the same story as traits, when youre in rapid development "Do it wrong but do it fast" you can just code with explicit types, after youve already nailed the PoC you can always come back in and coalesce the code down using generics to remove duplication.
      As for pointers, I dont really touch pointers in rust I havnt found a scenario yet where I actually need to use pointers instead of references.
      Rust is just as fast as any other language to prototype a PoC
      its slower to implement the final prod version, but thats because youre expected to actually code it properly instead of taking shortcuts which you SHOULD already be aiming for for a prod release, quick hacky code is purely in the realm of PoC's and should never be shipped, shipping that shit is just asking for technical debt.

    • @rumplstiltztinkerstein
      @rumplstiltztinkerstein Год назад

      @@MrTeathyme good point

  • @biggiefrosty
    @biggiefrosty Год назад +31

    I think when you are actually doing systems programming, Zig the language is better than Rust the language. A large part of that is the allocator story, and another large part of that is how difficult it is to write correct unsafe Rust. Zig is also really compelling for working with C and incrementally updating a C codebase.
    I think the Rust community does not spend nearly enough effort on making unsafe Rust safer in practice, to help people write correct safe abstractions. The Rust allocator story is pretty awful for many systems language use cases too. I think Zig succeeds on both of these fronts
    On the other hand, Zig has a whole lot of catching up to do with the tool chain and third party library ecosystem.

    • @Br4dButt0wski
      @Br4dButt0wski Год назад

      Odin is more simple and lots of options for custom allocators.

    • @vladlu6362
      @vladlu6362 Год назад +5

      Next rust release is focused on improving unsafe rust. Release 2024 will make all the safe rust features be also available for unsafe rust constructs. It will be better enough to compete.

    • @vladlu6362
      @vladlu6362 Год назад +1

      Allocators are very, VERY OS dependant. Even architecture dependent. Rust simply does not include it's allocator for embedded applications, and you must implement one for your device.
      Rust was not made around supporting C, unlike Zig. So yes, rust does prefer full rewrites, but I wouldn't say that it is a bad Idea.

    • @Br4dButt0wski
      @Br4dButt0wski Год назад +1

      Unsafe Rust is like a language inside a language. It was such a dumb decision. Unsafe Rust is anti-rust 100%

  •  Год назад +7

    Unit testing is good where it's needed. Mainly, on medium to high level functionality.

  • @vladimirbauer6604
    @vladimirbauer6604 Год назад +3

    Actually rust's macros are capable of introducing hidden flow control. For example "bail" and "ensure" macros from anyhow crate return implicitly. It's hidden control flow, they hide return keyword, which is imo bad.

  • @Re4mstr
    @Re4mstr Год назад +2

    You, my man, are peak entertainment.
    Please keep making videos.

  • @rogerdeutsch5883
    @rogerdeutsch5883 9 месяцев назад +1

    Fantastic rant about try/catch (exception handling is actually goto structure - error occurs and execution jumps to "unknown" location). Also, really like the mantra "errors add value".

    • @TheSulross
      @TheSulross 7 месяцев назад +1

      Using modern C++ I disable exceptions and use a template class based on std::variant for function return type - so a return is either the desired value or an error. Thus the coding style for error handling is much like Go. I also have a template that I call defer - it is constructed with a lambda.
      I use defer for RIAA cleanup of things like file descriptors, sockets, database connections - things that are not simple memory-only objects.
      So here too the coding resembles Go.
      And I uses std::span for passing anything that is array-like and std::string_view for span of string chars. Passing all array-like things via std::span means can use all the memory safe operations found on std::vector such as iterators and, say, range-based for loops. Can trivillaly use std::for_each, the algoritms, the new range-based feature of C++20, etc. (std::span doesn't get enough press to highlight what a game changer it is for writing safer and very versatile code that is still most efficient).
      If I then need to pass a string to an API that expects a null terminated C string then just use strndupa() to make a bounds safe copy of the string_view span that is null terminated and entirely existent on the stack, and pass that string to said API - but all the APIs that I write take std::string_view.. (I do hi-perf networking and it's an absolute no-no to touch the malloc heap when executing the data plane code paths. Using the heap is only permissible on control plane execution paths.)
      So do these things with modern C++ and life is very civilized - most hygienic, so to speak.
      The fact that C++ can directly consume C headers and directly interact with C is actually its super power - depite how much it gets flamed for being its legacy ball-and-chain.
      I'd say that Zig would be the definite better alternative for my domain use case than Rust would be. But modern C++ is just nailing things so well that there's just no compelling incentive for switching (let alone the cost and timeline of rewrite factors).
      The one annoyance is sprinkling noexcept on all the function declarations, but can certainly live with that. And if ever forget to add noexcept, well that's not a foot gun.
      Yeah, throwing exceptions was a dead end. We should all just repent and strive to be better people after acknowledging the error of our ways.

  • @SamualN
    @SamualN Год назад +9

    prime should do a stream with andrew kelley like he did with rich harris

  • @VACatholic
    @VACatholic Год назад +11

    Prime should do a review of Eskil Steenberg's projects in C. Would be interesting.

    • @explqicot3293
      @explqicot3293 Год назад

      I know he streams on twitch but do those streams get posted somewhere ?

  • @wWvwvV
    @wWvwvV Год назад +1

    I use unit tests to speed up development. The round trip to develop something is much faster in a unit test. 13:29 a well known golang library for testing is 'testify'. It has the assert functionality. It also has a require functionality, which will stop the whole test run because of preconditions. Assert continues to collect more test fails.

  • @gabereiser
    @gabereiser Год назад +2

    To add to the "no hidden control flow", here's a story from the battlefield. Team of top notch engineers build a multi-peta-byte capable backend for dataflow and processing. Front-end team using some node+react end up on a call with the big wigs about why the application is erroring out. They point to the top notch engineers, I do a search from the stack to where the function is that isn't catching the throw. Turns out, they were calling us in node without ANY try catch or exception handling using promises or async. NONE! NONE AT ALL! So when their "fetch" threw an error (as one should when you receive a 500 from a server) it didn't know what to do and so it did.... nothing.... No error message, no UI update, no notification to the user, no log, nothing.

    • @Big_Red_Dork
      @Big_Red_Dork Год назад

      How did they take having the finger being pointed back towards them? 😂

  • @arimill1045
    @arimill1045 9 месяцев назад +1

    I learned C when my friends took a minor introduction course and learned Java.
    To date they complain that they diddn't need to learn pointers, it made it more difficult for them to learn after the fact. So I say go all-in on complicated languages first.

  • @giorgos-4515
    @giorgos-4515 Год назад +2

    the exception thing sounds like something typescript could handle, like in java with the "throws Exception" and then force you to handle it

  • @RichardTMiles
    @RichardTMiles 10 месяцев назад +1

    Google on Monday donated $1 million to the Rust Foundation specifically to improve interoperability between the language and C++. C++, a popular general purpose programming language, has arguably fallen out of fashion due to concerns over safety.Feb 5, 2024

  • @НиколайНосорев-о5ц

    I think it is quite not so easy for beginners compare to C/C++ where you can dip into lang smoothly step by step. Console print function is not so intuitive at first, and Heap allocating is also require understanding of std library. But for professionals aiming for full control it would be a good choice (after release of 1.0)

  • @Solid_Fuel
    @Solid_Fuel 5 месяцев назад

    update for those not in the know, zig moves fast!
    some of primes concerns are mediated already, and many more things are to come.
    it is very fun to watch this language grow and evolve

  • @efkastner
    @efkastner Год назад

    13:23 “I don’t do red-green-refactor”. I take very similar stance to Prime on testing for the most part, but probably lean a little more on the fewer tests side. One thing I do, which might be different than what is being referenced here, is when a nasty bug comes up that I want to guard against regressing is to write a test that fails before fixing it (which then passes). There have been far too many times when I either think I’ve fixed a bug but actually didn’t, or had a regression but lost context on how it was fixed before (b/c the code has changed too much that git directly before/after the fix doesn’t show how to fix it NOW) that this is non-negotiable for me. Maybe this has a different name

  • @hrgdavor
    @hrgdavor Год назад +1

    Not all errors are recoverable, so I would argue that there is place for checked and unchecked errors. Old days when Hibernate throwed checked operations from every method (any sql query could fail do to loss of connection) .... was a living hell.

  • @magikworx3748
    @magikworx3748 Год назад +2

    Try Catch2 for c++ testing. Super lightweight, one header. Not crazy amounts of overhead syntax.

  • @brqnet
    @brqnet Год назад +2

    Zig has an official package manager called zpm, which can be used to manage dependencies and build your Zig projects.??

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  Год назад +1

      this must of been some what recent

    • @etodemerzel2627
      @etodemerzel2627 Год назад +8

      ZPM is not an official package manager. Neither is zigmod. The devs have only recently started working on the official package manager (there's an article from October last year), it will be a part of the compiler.

    • @SuperHeroINTJ
      @SuperHeroINTJ Год назад

      Just use Nix.

  • @MDarkus3
    @MDarkus3 Год назад

    Sorry, I am late to the party. I am an embedded C developer and I have a question regarding the sentence at 5:20
    Why C macro expansions are considered "devil" and why are they bad?

  • @Jankoekepannekoek
    @Jankoekepannekoek Год назад +1

    Yes, that's exactly how zig does errors; you can declare error sets, which are effectively sum types.

  • @leonlysak4927
    @leonlysak4927 Год назад +4

    If you like Zig you'll love Nim! writes and reads like Python, compiles to C/C++/Objective c/Javascript, best FFI and interop, has a python-nim bridge, no memory management (unless you want) with the same performance as C, the list goes on. I love it

    • @leonlysak4927
      @leonlysak4927 Год назад +1

      @@kishirisu1268 There isn't an additional layer they're compilation targets. You have a single, concise syntax to do it all without sacrificing anything. I find it absurd that you find this absurd

    • @lod2414
      @lod2414 Год назад

      @@leonlysak4927 So it just sounds like code generation. YOu write Nim and it compiles to one of those other languages? or bytecode or machine code?

    • @leonlysak4927
      @leonlysak4927 Год назад +1

      @@lod2414 Exactly. If you target a c/c++ backend it will produce optimized c/++ code and then gets ran through your normal c compiler. For javascript, it just produces the code in a single file. There is a WASM and LLVM backend too but I haven't used them

  • @tekneinINC
    @tekneinINC Год назад

    12:30 You hate what they did with go, needing 3rd party stuff for good unit testing….? I don’t understand where you’re coming from with that at all.
    Don’t get me wrong, Im still pretty new to go, somewhere within 1-2 years of experience with it… but I don’t think I’ve hit anything I couldn’t test adequately with just the built in testing functionality…?

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  Год назад

      no, its that go didn't make good testing a part of the system itself. proper asserts and more.
      tests tend to be very verbose for this reason because you need to signal in this inverted way (t.error)

    • @tekneinINC
      @tekneinINC Год назад

      Ahh, okay, that makes more sense.
      I’m typically using the ‘test table’ style, so it’s just assigning the ‘test name’ / ‘args’ / ‘want’ / ‘got’ values in a list, which doesn’t feel too bad as is.

  • @FlaviusAspra
    @FlaviusAspra Год назад +1

    I agree with having to go through C, but I don't think it's "just so you can have the experience". I think it changes your mindset, you learn to pay attention yourself to details (the compiler and the C runtime won't).
    I would argue every new type of programming makes you a better programmer in all languages.

  • @debasishraychawdhuri
    @debasishraychawdhuri Год назад +1

    How can someone hate unit testing? How else do you run your code check if it is working?

  • @trondenver5017
    @trondenver5017 Год назад +7

    This video was very enjoyable. Thanks.

  • @jeffreyhymas6803
    @jeffreyhymas6803 3 месяца назад

    There was an episode of Myrhbusters years ago where they tested a myth about blind drivers. They found it was easier for a blind driver to follow the instructions of a literal backseat driver than it was for a blindfolded person who can see. The blind person has absolutely no preconceptions, they've never driven before. They just do exactly what they're told. People with previous driving experience couldn't help but want to apply all their own preconceptions and habits to the situation.
    I sometimes think this same idea would apply to Rust as a first language. Most people struggle because Rust is very different from the expectations they can't help bring with them (why FP bros have less trouble, their expectations align). New folks have none.

  • @Dygear
    @Dygear Год назад +1

    FFIW, Windows NT 3.5 did have a MIPS build. #16:00

  • @samhughes1747
    @samhughes1747 Год назад +1

    Your thought at 23:56? THIS! This is what bit me hard going into Rust. Learning it was like a bootcamp in the "break you down, destroy your understanding of the world, and recreate you brick-by-brick" sense. It took a while, but it had to unlearn a bunch of bad ideas I picked up from various dynamic languages. Fantastic observation.

    • @fulconandroadcone9488
      @fulconandroadcone9488 Год назад +2

      I beleave any scripting language used to create anything more than 100 lines such as bash scripts is a bad idea.

    • @samhughes1747
      @samhughes1747 Год назад

      @@fulconandroadcone9488, what's a "scripting language" :p. Try to answer without describing dynamic/hosted languages.

  • @phillipgraham1422
    @phillipgraham1422 6 месяцев назад

    Some programming languages are like a hammer, some are like a Swiss army knife, and some are like a triple decker craftsman toolbox.
    What I love about rust is that it is the triple decker craftsman toolbox of languages. Coming from my education/career which was entirely in C, C*+, and J̶̧͎̯̔͊a̴̖̺͂v̶̜̄̒ȁ̶̤, Rust felt different from all of them. It felt like learning to program again. Rust is amazing because when I want a specific tool I just find it in the toolbox and it is a fully functioning, well maintained, safe tool. The problem is filling through the drawers of the triple decker craftsman toolbox and knowing what tool to use. It’s less intuitive but can be very powerful. When you are holding a hammer everything is a nail if it doesn’t have to look pretty and when you have a Swiss army knife you can solve any problem if it is small enough, but with the full toolbox you can make the ideal solution for most problems once you get familiar with it.

  • @vnshngpnt
    @vnshngpnt Год назад +17

    Damn your reactions are so funny. This is what modern programming community lacks, honesty and fun, everyone is super snug and "kind" on other platforms and it just ends up being boring, uninspired and boys just block each other lol.

  • @GeorgeTsiros
    @GeorgeTsiros Год назад

    2:13 which function catches it?
    _you don't care!_
    there has been an exception, the program - if all goes well - will dump information and signal for termination.
    Why do you want to catch it? What benefit does it provide you to know who is going to catch it?
    There are some weird cases where you _must_ catch an exception for the program to _actually function_ correctly. Being weird cases, by definition you go outside the normal coding conventions. You do not design a language based on _that_ .

  • @abhinavk0929
    @abhinavk0929 Год назад +3

    He mentions carbon as the "language we already have" when carbon doesn't even have a simple compiler yet. That's how you know that guys knows nothing about what he's talking.
    ]

  • @bluecoffv
    @bluecoffv Год назад

    24:19 did he just quote slavoj zizek?

  • @TheKahiron
    @TheKahiron 9 месяцев назад

    As an embedded C dev, I've been wanting a C with fewer "implementation defined", and some sensible quality-of-life ADA features - Zig looks very promising. Packed data types like Zig's may not be as pretty as the ADA type syntax, but it's still looking grand for mapping up register bit fields.

  • @sinom
    @sinom Год назад

    functions not having what it throws in the signature is also one of the biggest problems in C++. Yeah you do have noexcept there but almost no one actually uses that correctly and it's basically only in code documentation and doesn't actually enforce anything

  • @xBZZZZyt
    @xBZZZZyt Год назад

    03:33 what about python3?
    everything can raise exception if you press Ctrl+C

  • @emjizone
    @emjizone Год назад +1

    7:50 You know you spent too much time on _Vim_ in a windowless room when…
    …you see bloat in _C_ . 😄

  • @LoveLearnShareGrow
    @LoveLearnShareGrow Год назад +1

    Under da C! Under da C! Darling it's betta down by da metal, under da C!

  • @raph151515
    @raph151515 Год назад +1

    try catch are magical when you get some levels of recursion/calls/loops and you need to break to many levels up in the stack, nothing can beat this

    • @etodemerzel2627
      @etodemerzel2627 Год назад +2

      Zig has labeled loops, so you can break out of any loop you want.

    • @beefbroccoli5489
      @beefbroccoli5489 Год назад +3

      magic is the right word, but voodoo might be even more accurate.

  • @zebastianjohanzen3865
    @zebastianjohanzen3865 9 месяцев назад

    My old man started programming on a Burroughs mainframe in the 1970s. Yes they literally wrote their programs on paper! The handwritten program would be given to a typist who would type it out onto punch cards. It would then be given to a second typist who would put the punch card machine and verify mode and retype the program. Then they would get the punch cards back and look through them to find the remaining errors. Then they would send it to be compiled, and they would get the compile errors the next morning.... The process repeats.

  • @sachindraragul1094
    @sachindraragul1094 Год назад +1

    I thought the video is 7:36 long but I think it goes for about 30 mins. What kind of hack is this?

  • @KANJICODER
    @KANJICODER Год назад

    @13:00 , The rigidity of TDD is kind of stupid. I advise writing whatever is CLEAREST in your head at the moment. Maybe that is the tests, maybe that is the implementation.

  • @AloisMahdal
    @AloisMahdal 9 месяцев назад

    Regarding the last part, I think "maintain it with zig" is a really powerful way to put their foot in the door of C.

  • @yash1152
    @yash1152 Год назад

    4:09 how do u know so accurately abt how things work in langs u dont even know?
    experience or do u learn it before hand?

  • @briandawley7808
    @briandawley7808 Год назад

    I have no idea if this is best, but 30+ years ago when I learned programming at first, I learned BASIC. I didn't learn about things like loops and function calls, those were things I had to make on my own. Then when I went into undergrad and learned about them, it felt like cheating... BUT I also knew how they were working "under the hood." So I think a good way to learn the basics is to learn how they work in implementation, even if you don't necessarily build a whole project that way.
    My kids are interested in learning programming and I'm struggling with the best way to teach them. I think the best way is to start with just very simply, here's what a computer is: a processor and memory. Instructions are stored in memory sequentially, and the processor just executes those instructions in order, and here's what those instructions look like (a la BASIC). From that basis, then we can build in the concepts of loops and function calls, then data structures, etc.
    I don't know though. I don't know the best way. Maybe Harvard CS50 is best?

  • @hendrikmartina3552
    @hendrikmartina3552 Год назад +1

    Errors as values
    Correct if I'm wrong but Isn't that related with monads?

  • @onerimeuse
    @onerimeuse Год назад +3

    Jeeeeesus, for a programming channel this is iiiiintense... Love the energy. Keep on!

  • @HrHaakon
    @HrHaakon Год назад +1

    Just as an annoying WHELL ACKYUHALLY about the hidden control flow:
    You have CHECKED exceptions. These are exceptions that the compiler forces you to deal with. These are very much not hidden, and a lot of developers hate having to write their code in a safe and reasonable manner. (Guess which one Java uses by default.)
    Then there are UNCHECKED exceptions. These do not force you to deal with them and will happily bubble up your call stack until they're either caught by a framework, or they blow up your entire program. C# uses this.
    There has been a flamewar over checked vs unchecked exceptions in the enterprise space over this for two decades or so. I have my own opinions, but I'll keep them to myself.

    • @Big_Red_Dork
      @Big_Red_Dork Год назад

      Why not share? This comment section is full of great discussion

  • @Christian-of1tz
    @Christian-of1tz Год назад

    So do you do other kinds of testing instead? End to End?

  • @alphabasic1759
    @alphabasic1759 Год назад +2

    The big problem with a lot of the more recent languages (or languages that have evolved a lot recently) is the excessive syntax. There are just too many syntactical additions in languages like rust or even python or recent versions of JavaScript for that matter.

    • @homelessrobot
      @homelessrobot Год назад

      are they really 'too much' though? What is your metric for the justification of new syntax, and whats it's 'cost'?

  • @SolidAir54321
    @SolidAir54321 Год назад +1

    In the beginning the host seems to be complaining about javascript which I'm not familiar with, but I think I could make a better argument for exceptions when it comes to C++. Often people who complain about exceptions wouldn't actually check all return codes anyway of they used return codes or else are using exceptions incorrectly.
    One reason exceptions are beneficial is BECAUSE it is hidden control flow. Or rather, it lets you focus on the normal control flow without having error flow intermixed in between and making it harder to reason about. In C++ at least, you know whether a function might throw an exception just as well as you would know whether a function is going to return an error code. Exceptions cannot be ignored. Do you really check every single memory allocation in you code to see if it fails or not? Every one???? And then what does you code do if it fails?

  • @vitorhideyoshinakazonebati7531
    @vitorhideyoshinakazonebati7531 Месяц назад +1

    In my first job i had to reverse engineer a C database extension. And the funny part is that i was hired as a Python Dev 🤣

  • @daniellewis984
    @daniellewis984 2 месяца назад

    I unit test all of my self-made library code extensively, which reduces my bugs to the stuff you might put in a main()

  • @androth1502
    @androth1502 Год назад

    i'm conflicted between zig and odin. and my only problem with odin seems to be semantic.
    having to type some_module.method( object, args...) somehow annoys me when i should be able to type object.method(args...)

  • @heater5979
    @heater5979 Год назад +2

    Vector comes about because the creator of the C++ Standard Template Library, Alexander Stepanov, called its arrays Vector. A mistake he says he regrets in one of his video presentations. Which I on RUclips someplace. Everyone else has continued with "Vector" since then, it's tradition.

  • @juergenm6107
    @juergenm6107 Год назад +1

    NULL termination: Use clang-tidy and activate "bugprone-not-null-terminated-result" and "bugprone-string-literal-with-embedded-nul¶".
    Problem solved. I couldn't image programming C or C++ without clang-tidy and clang-format. And please active the clang- or the gcc-sanatizers as well.

  • @djazz0
    @djazz0 Год назад +5

    Been coding in Nim a lot lately, it’s a lot of fun! What’s your thoughts on it?

    • @piqueras_
      @piqueras_ Год назад

      Literally scrolled down looking for Nim gang lmao. Recommending it to everyone as well.

  • @brucearmstrong5536
    @brucearmstrong5536 Год назад

    2:35 so relatable I had to check which function is gona catch and stuff , error handling gets ugly

  • @krisdabrowski5420
    @krisdabrowski5420 Год назад +6

    I've been using Odin as my systems programming language of choice. I liked it so much I ported my C++ (ptoo!) project into Odin and it was way easier to extend, work with, and came out to less lines of code when I ported it directly. I'm interested in Zig, and have done a few trivial things in it, but haven't made anything big with it yet. Zig does feel like it's got a thick layer of boomer-programming aesthetics... Not good or bad, Zig just *feels* like an old language.

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  Год назад +2

      interesting. lots of people talking odin

    • @krisdabrowski5420
      @krisdabrowski5420 Год назад +3

      @@ThePrimeTimeagen Get gingerBill, the BDFL of Odin on your show. You'll have a great time!

    • @andrewdunbar828
      @andrewdunbar828 Год назад

      @@krisdabrowski5420 GingerBill, Andrew Kelly, and Joe Blow are always worth listening to when they're talking about languages and compilers.

    • @They0ungTravler
      @They0ungTravler Год назад

      @@ThePrimeTimeagen Odin is great. I’ve been using it and it’s really made graphics programming easy and understandable for me! You should cover it!

  • @n0xx295
    @n0xx295 Год назад +7

    Zig's main advantages when compared to Rust is the fact that it's a much simpler language with a much simpler syntax, and therefore has much better ergonomics than Rust.

    • @theoDSP
      @theoDSP Год назад

      I would say much better developer ergonomics.

    • @Evan490BC
      @Evan490BC Год назад

      Not for me, thanks. I prefer not to pass around allocators and other low-level BS.

  • @andrewdunbar828
    @andrewdunbar828 Год назад +2

    I like Rust and Zig (and Swift). I wouldn't say Zig is better than Rust because it depends on your criteria, most of which is usually subjective.
    To me C is more low level than Zig. Maybe passing allocators around and I think not having temporaries would be things that are lower level in Zig than C.
    As someone who came from the 8-bit days and programming in assembly before C I always found C had bloat, but a lot less than almost every other language.

    • @FlanPoirot
      @FlanPoirot Год назад +2

      other things that makes zig more low level than c is alignment, alignment is a first class concern in zig, there are a bunch of built ins to mess with memory layout where in C there's almost none. but yeah overall zig has more high level features than c does, that's how it manages to become a "better c". if it had the same level of abstractions it wouldn't be that different from it

  • @micaelsoftbinbows
    @micaelsoftbinbows Год назад

    WAIT are you always sitting on a bouncy ball when you stream? :O

  • @abuk95
    @abuk95 Год назад +3

    Why is nobody talking about Nim?

    • @terryriley6410
      @terryriley6410 Год назад

      It suffers from the bus factor and the fact that many "low-level" people dislike identation sensitive syntax.

    • @abuk95
      @abuk95 Год назад

      @@terryriley6410 it also does not solve any specific problem. I am not using Nim anymore. It feels useless tbh. The tool ecosystem is also not rich

  • @akamenskiy
    @akamenskiy Год назад

    Am I the only one when heard "below the C-level" joke had a one specific tune play in my head that goes along with the lyrics "arrrre you rrready kids? aye-aye captain!"

  • @ppvan
    @ppvan Год назад +3

    Is Rust worth it? Last time try to learn it, i end up fighting the borrow checker in frustrations

    • @ppvan
      @ppvan Год назад

      @random bit i do heavily use java principles when learn Rust. I thought it was a mapping help me move fast but it not.
      Thanks for the clarification. May be i will try Rusy one more time

    • @taragnor
      @taragnor Год назад

      This is the usual learning curve with Rust. The borrow checker really has to grow on you. At first it's intensely frustrating, but later on the benefit of writing good code will save you a bunch of worrying over later bugs. And it does get easier the more you start to think in a Rust mindset. For me, lifetimes were always the hardest thing, because they were something I never really thought about before.

    • @jcbritobr
      @jcbritobr Год назад +1

      ​@@ppvan you did all inverse what rust were. Rust is static and immutable and all variable owns his memory. In java most of things is dynamic and variables share his memory. You need to think static in rust.

    • @O...Maiden...O
      @O...Maiden...O Год назад +1

      @@ppvan học Rust mà lại mang tư tưởng của ngôn ngữ khác vào để đối sánh là dở rồi :))

    • @ppvan
      @ppvan Год назад

      @@O...Maiden...O ai mà biết âu, áp dụng đc mà nhưng đến rust thì failed 😅
      Sorry others, we're using Vietnamese if you wonder

  • @uris77
    @uris77 Год назад

    My analogy of exceptions is this: imagine you are dining at a restaurant and you are paying the bill. And your credit card is rejected or the network is just down for some reason, so the payment can't be processed. The waiter then shoots you in the face. That is what an exception is to me..... getting shot in the face because something somewhere went wrong.

  • @adhillA97
    @adhillA97 Год назад

    17:00 Harvard teaches C first before any higher level language, which you can see in the publicly available version of their introductory CS50 module, CS50x

  • @sir_no_name1478
    @sir_no_name1478 9 месяцев назад

    I do not get the sequences in the Car like at all.
    Why did he ban the dude?

  • @toastom
    @toastom 5 месяцев назад

    I love the idea of Zig and maybe it's just because I'm brand new at learning a newer language, coming from mainly C, Python, and MATLAB the past few years, but the Zig compiler always seems so angry at me :D. A very difficult to write language at first, but I can see if you can get good at Zig then you must be an incredibly talented programmer.

  • @binary132
    @binary132 11 месяцев назад

    The main thing I hate about Zig is that it’s built on LLVM so it’s practically impossible to build from source on Windows.

  • @carlmuller4392
    @carlmuller4392 10 месяцев назад

    C bloat? It does a copy of initialized data and if you are fancy clears the bss section and sets the stack pointer. Contains a few helper functions if you use longs or floats or divides.

  • @jongeduard
    @jongeduard Год назад +1

    Hmm, multiple languages are now kind of trying to be better than Rust. Here we have Zig, but there's also the V language, and there are probably even more coming up.
    The issue is that these programming language projects are all very young and unfinished. While Rust is actually very mature in comparison and has really started to break through. Quite a difference.
    Those other projects still risk being descontinued when things end up not being popular enough and people stop investing in them.
    A lot of time has been invested in making Rust a very well designed, robust language.
    Things might change in the future, but I think at this moment Rust is still the most interesting one to continue learning.