177 pointsby tosh5 hours ago14 comments
  • brabel3 hours ago
    I just upgraded some code to Zig 0.16.0 and I am actually really happy with the results. It impacted A LOT of things, but the changes were actually very good and seems to have set the language for a bright future, especially with the new IO mechanism which allows supper efficient code that looks good whether it's implemented single-threaded, multi-threaded or just via an event loop!

    If you haven't tried Zig since 0.16.0 was released, I highly recommend having a look. The release notes for this release were huge!!

    https://ziglang.org/download/0.16.0/release-notes.html

    • afirmativ15 minutes ago
      Maybe one day it'd be possible to use these new features, but I find myself using `.use_llvm = true` in my zig builds for stability and lesser tested targets.
    • ulbu2 hours ago
      the “(super) efficient” is not there yet. Io is still dynamic dispatch with multiple layers of indirection. afaik it’s slower than before.

      the upcoming releases are expected to provide a solution to this “dispatch is comptime-known, but still dynamic” problem, and drop the loses in efficiency.

      • bbkane23 minutes ago
        Hmm in the 2025 talk ( https://youtu.be/f30PceqQWko?si=qZESxMaSyt7fYMfz ), Andrew emphasizes that this approach is more efficient than before- even showing compiled assembly iirc. I guess that was a one-off?
      • rsyring29 minutes ago
        The parent seems to be talking about efficient code style, not necessarily performance implementation, as they go on to discuss how it looks.

        That is, I think the point was DevX not io performance.

  • portly3 hours ago
    After having used Zig for a couple of months now I am convinced it is a fantastic tool language. You just pick it up to hack some idea together freely. Every time I hit a wall, I find the creators have thought of it already and offers comfort. But nothing gets in your face how to use the programming language "correctly".

    For me it is now the go-to "tinker in my garage" language.

    • ACCount373 hours ago
      Is it really that good?

      My go-to "tinker in my garage" language is Python - lightweight syntax that stays out of your face, batteries included, packages for everything that's not included. What's Zig's edge?

      • dmit3 hours ago
        Have you ever thought "Ugh, this bit of Python code is running much slower than I expected on my computer. Wonder if anyone has written a native library for this"? That's probably the closest use case for someone who matches your description -- a language that is much more ergonomic, much more 'modern' feeling (in all the good ways), while still extremely compatible with C.

        As for the language itself, it's going to be more verbose than your Python code. Cons: you'll have to spell out a lot of things that you thought were obvious assumptions. Pros: you will be able to look at a page of code and know with a great degree of certainty that there are no hidden gotchas. No monkey patching, no __init__. Basically, it just does what it says on the tin.

        And finally, about the std lib and batteries: there's HTTP(S), compression algorithms, hash algorithms, RNG, I/O, the basic data structures you'd expect, JSON. Third-party libraries, if you choose not to vendor, are handled by including the repository url in a file (also automated by a CLI command), and then adding it to the build script (not automated). The `zig` command handles fetching and ensuring sanity, but otherwise assume a bit of elbow grease will need to be involved.

        • ACCount373 hours ago
          Rarely. Most tinkering tasks just don't have enough heavy duty computation in them to as much as strain a modern CPU. And most of the rest are covered by packages like numpy or pytorch.

          For the rare exceptions, I make a C lib and call into it to get my numbers crunched. I get that Zig is a viable replacement for C there. But I don't see it replacing Python.

          • lenkite35 minutes ago
            Even if you are fine with Python's speed, its memory consumption DOES effect things and can be an extraordinary pain when you need to fit the result of your tinkering in any sort of constrained environment.
          • archargelod39 minutes ago
            > For the rare exceptions, I make a C lib

            The problem is that most people using Python don't have enough expertise in C to do the same.

            It also kinda destroys the argument that Python is good if your solution for performance is to use a different language alongside it.

          • p-e-w2 hours ago
            Not to mention that where heavy computation is required, Python often has libraries that are much, much faster than anything you can quickly hack together in C or Zig.
            • maleldil2 hours ago
              As long as you can express everything you need on the library's terms. As soon as you write a Python loop, your performance plummets.
            • bluecalman hour ago
              Only if you doing something thousands of people has done before. Anything new, even very simple and you are on your own and Python is 100x slower than naive C implementation on many tasks.

              Last little project I remember is writing a solver for a puzzle game my friend published. Python just doesn't work at all for such tasks.

              I think you are wrong about speed of those libraries as well. In my experience naive code designed for a specific task beats highly sophisticated general code and it doesn't take a rocket scientist to get huge speed-ups over some well established fast library.

          • miki1232112 hours ago
            And if you really need more performance (or, more often, fast startup times), Go gives you 90% of the speed with 30% of the effort. Rust if you really want to squeeze everything that can possibly be squeezed of that CPU.
        • archargelod43 minutes ago
          That's actually a great argument for Nim[0]. Easy interop with C, native-speed performance, and a syntax very close to Python in both readability and how quickly you can get something working.

          Batteries included, automatic memory management without a conventional GC and metaprogramming - is a really cool combination.

          [0] - https://nim-lang.org/

          • tatjam26 minutes ago
            Aggh if only its LSP was better! I have always run into issues when using Helix with it (it kept crashing), and I'm absolutely spoiled by good LSPs in other languages :(

            Wish I had the time and skill to actually contribute to the LSP, if you have ever used Nim it's a seriously underrated language.

      • norman7843 hours ago
        Zig is low level, so it will certainly not replace your python usage, it is more like a modern C than anything else. There’s a video of a recent interview with Andrew Kelley, if you want to watch it to understand better what Zig is for, it’s on Jetbrains YouTube channel.
        • ACCount373 hours ago
          No, I get that, but Zig being low level is kind of why I don't get why it would be a good tinkering language?

          When I want to tinker, I just want my logic to work, first of all. In 9 cases out of 10 that means going for high level. Even if the resulting code works with low level things like binary structures.

          • mcdonje2 hours ago
            You have a weirdly restrictive definition of "tinker"
            • ACCount3740 minutes ago
              Not really?

              I've been places, from embedded bare metal to ML AI, and that "embedded bare metal" end is the one place I don't use Python directly in. Embedded bare metal is just ruled by C forever.

              Bit of a shame, because C is kind of bad at its job, but nothing else has the "compatible with everything" badge of honor.

              The tooling around embedded devices though? Python.

          • andyferris2 hours ago
            Low-level programming gets a bad name because C has many footguns and the spec leaves much behavior undefined - a fact that implementers use almost adversarially (which I'd support, if the goal was to refine the spec...).

            C++ adds more high-level conveniences without actually removing the footguns and undefined behavior (much C code compiles in a C++ compiler).

            Zig tries to keep the low-level C philosophy but have things more well factored and well defined. The result is you _can_ tinker in high-level code, yet "drop down" into low-level code as you desire.

            (Compared to rust, you get fewer compiler-enforced guarantees, but unlike C the language isn't trying to make high-level code adversarial).

            • jcul2 hours ago
              It made me laugh to think of C implementers being adversarial! It can feel that way.

              I haven't really used modern C, not sure if it's evolved as much as modern C++, which I feel is a joy to use, and a lot safer. But then I've been writing C++ for decades.

              I feel like C evolved from basically syntax sugar for assembly, so that's where all the footguns come from, rather than being actually adversarial.

              • robinsonb5an hour ago
                If some of the things that the C standard left undefined had instead been made implementation defined then the compiler would at least be obligated to do something that makes sense on the target architecture, rather than having license to take the lawful-evil route. (Plenty of architectures have addressable RAM at location zero, for instance.)

                For some reason this always brings to mind that moment in Red Dwarf where Kryten, devoid of his behavioural chip, deems it appropriate to serve roast human to his crewmates. "If you eat chicken, obviously you'd eat your own species as well, otherwise you'd just be picking on the chickens!"

              • ueckeran hour ago
                Both C and C++ compilers (in fact, they share this part) very aggressively exploited undefined behavior for performance. But I this was certainly not adversarial. Programmers also regularity picked optimizations over safety. I think nowadays the unsafety of C with modern tooling vs the safety of - say - Rust is very much exaggerated.
            • pjmlp2 hours ago
              Basically what the world has lost by ignoring Modula-2 and Object Pascal, and going down the C path.
              • archargelod25 minutes ago
                The spirit of Pascal lives on in Nim.

                It's arguably the closest modern language (with a sizeable community) to the Wirthian languages.

                • pjmlp9 minutes ago
                  I would add that Delphi still follows along, enough for an yearly conference in Germany, and that C# since getting Native AOT and the low level programming improvements, is close enough to Modula-3 design.

                  There is Swift as well, although quite far from Wirthian compile times.

          • 3 hours ago
            undefined
          • 2 hours ago
            undefined
          • brabel2 hours ago
            Tinkering means different things to different people! Want to tinker with your hardware, as bare metal as possible? Or extract every inch of performance out of your CPU? Zig is great for that.
      • flosslyan hour ago
        You both like different types of tinkering.

        Some people put a generator on a tesla cybertruck and call that garage tinkering.

        Some people make a go-cart out of a lawnmower and call that garage tinkering.

        The first is the "batteries included Python" tinkering, the second is the "low level Zig" tinkering.

      • miki1232112 hours ago
        And not only that, if you're doing something in Python, somebody has done it before. Maybe not this exact thing, but something close enough to it. LLMs know it, Stackoverflow knows it, whatever esoteric protocol or file format you're trying to interact with, somebody wrote a library for it in the Python 2 days and has ironed out all the bugs since.

        There's no other language quite like Python in this regard. Typescript is a close second, but the lack of metaprogramming facilities, no access to the type annotations at runtime, and the lack of operator overloading make some things needlessly complicated and uglier than they have any right to be.

      • dtj11232 hours ago
        The only language I've historically been able to claim to know without feeling like I'm straight up lying has been Python, and having got past my first maybe 1000 lines of Zig I can say pretty confidently that whatever magic makes Python feel comfortable to write, Zig has too.

        It requires more of you in some ways, notably that you have to understand the basics of memory management and the behaviour of the stack, but so far I've found the affordances that the language provides for handling this stuff feel very intuitive.

        The only sharp edges I've felt so far have been the sometimes hard to guess locations of things in the standard library, and the permenant anxiety that arises from knowing I'm going to be a few more versions behind the current release with every month that passes.

      • portly3 hours ago
        I like that you have more freedom. You can play around with some idea but once you want to do something "serious" you can break into it directly. I start simple but sometimes blip into some performance obsession and I find Zig allows that.
    • xyzsparetimexyz42 minutes ago
      > But nothing gets in your face how to use the programming language "correctly".

      It doesnt let you have unused variables and theres no multiline comment support. These are fairly significant productivity issues for me

      • afirmativ21 minutes ago
        I agree - can't create and toggle between rough code sketches of functions in a source file without these features. It's more than annoying.
      • galangalalgol32 minutes ago
        What do you like to ise those features for?
        • xyzsparetimexyz27 minutes ago
          In rust, having unused variables as a warning (but not an error) let's you refactor code, test it and see what is now unused as a result. You can then remove the unused items. Zig requires you to remove the unused items (e.g. with '_ = ...;' which is then something you might forget about) before testing, increasing friction.

          Multiline comments are less important, but its still convenient for commenting out large chunks of code. IDEs make this a bit easier when you can press e.g. Ctrl+/ to comment out the selected lines with //, but it doesn't work in all cases.

          The friction stops zig from being fun imo. A shame because I really like comptime.

          • galangalalgol14 minutes ago
            Thanks, there is always a risk of people jumping on replies like that to scream that you are doing it wrong. I just wanted to see how other people do stuff. Hope everyone stays nice.
        • Weebs24 minutes ago
          Not the person you replied to but I leave unused variables as future TODOs. It's a warning in F#. I also often use them for inspecting data in the debugger
    • samuellan hour ago
      My main issue with this is I expect Mojo to become the go to tinkering language for me.
    • asibahi3 hours ago
      It’s definitely a great tinkering language but .. eh .. the Zig team and community are extremely opinionated about how to use the language correctly.
  • xngbuildsan hour ago
    After watching Andrew Kelley's interview video makes me want to pick up Zig: https://www.youtube.com/watch?v=iqddnwKF8HQ
  • biffgiff13 minutes ago
    Why would I want to use this over, say, Node.js and TypeScript?
  • epolanski4 hours ago
    This sounds like great news, Zig's compilation times are already terrific and this is going to only make them better.
    • pjmlp2 hours ago
      Yes, compilation speeds of the 90's are slowly making a return, thankfully.
      • bbkane18 minutes ago
        I thank Go for this. Go's compilation times seemed to inspire other language devs
    • dmit3 hours ago
      > Zig's compilation times are already terrific

      In my experience, this (for now) is mostly aspirational. It's obviously a major goal, and there are clear milestones outlined on how to achieve it, but in practice the initial compile of an empty project or the excruciating pause when you `direnv allow` and ZLS needs to be (re)built are not what I'd describe as "terrific".

      • schaefer3 hours ago
        >(re)built are not what I'd describe as "terrific".

        It sounds like you are a strong candidate to try out the new improvements mentioned in this devlog and see what benefits you can get for yourself.

      • epolanski3 hours ago
        Maybe you're right, but how many other system programming languages toolchains give you sub 50ms recompilations across millions of LoC?
        • dmit3 hours ago
          I foresee a pjmlp comment in your near future. :)
          • epolanski3 hours ago
            Yeah, let's add a sprinkle of toxicity to my Saturday morning!
  • nromiunan hour ago
    Is there any proposed timeline for a stable release? Big features like the recent async IO shows the language is very unstable right now.
    • xydonean hour ago
      There is no ETA on 1.0, but breakage has followed the pattern of it not really being hard to upgrade to a newer version, as it is very well documented on the version release notes.
    • brodo41 minutes ago
      nitpick: The language is pretty stable, what changes is the standard library.
    • bluecalman hour ago
      Andrew's take is "it's ready when it's ready but we hope it's good enough before it's fully ready that you want to use it anyway".

      It's different and I like it. You get one shot at it and may just as well get it right in as many areas as possible.

      • nickmonad2 minutes ago
        Yep. He mentioned recently in his JetBrains interview he wants Zig to be a language for the next 50 years. Rushing 1.0 for the sake of signaling to the wider industry today would be actively harmful to that goal.
  • IshKebaban hour ago
    Zig has so many compelling features, and I'd even be willing to give up Rust's near-perfect memory safety in some cases. But the one thing that really put me off is string handling. It's just so super tedious. I like being able to finely manage individual string memory allocations, but I really don't want to have to do it all the time. RAII is great; I wish they'd use some light (optional) RAII for strings and containers etc.
  • steveharing13 hours ago
    So i checked the license of this project, can anyone pls clarify what is (Expat) after MIT License
    • papercrane2 hours ago
      There are a number of licenses that are named MIT that are all similar, but not identical.

      The "Expat" here is the MIT license variant. It is referring to the Expat XML parsing library that first used this license.

      Usually when projects these days use an MIT license this is the version they use.

    • maleldil2 hours ago
      There are different licenses that used to be referred to as "MIT", and explicitly stating "Expat" tells you which one they're referring to (in this case, the "standard" one). This is largely unnecessary, as nearly all mentions of the MIT license refer to this one.
  • abhayji4 hours ago
    [flagged]
  • abhayji4 hours ago
    [flagged]
  • baskduf5 hours ago
    [flagged]
  • lerp-io4 hours ago
    [flagged]
  • KingMob3 hours ago
    [flagged]
    • alkyon3 hours ago
      Carpentry would have been ideal career. Building real things, artisanal or not, and nobody insisting yet that the chest of drawers you're building include AI
      • KingMob2 hours ago
        Of course, the flip side is, modern construction isn't done with artisanal woodworking techniques.

        I'm not even thinking of AI, but Rust. I guess I'm just uninterested in a "modern C".

  • xtreak292 hours ago
    Bun is moving towards rust but does this also help bun's compilation times?

    https://ziggit.dev/t/bun-s-zig-fork-got-4x-faster-compilatio...

    • androiddrew2 hours ago
      I think bun is moving to rust because Anthropic owns it and the devs there like rust. So why would they invest in another implementation? Sad to see a good zig example go, but as soon as Anthropic bought it I wrote the project off.
      • xorgun2 hours ago
        [dead]
      • pylotlightan hour ago
        Just plain incorrect.. please stop spouting this nonsense, this is not the reason whatsoever.
        • amazingamazingan hour ago
          What is the reason?
          • galangalalgol27 minutes ago
            I am not aure either, but bun wasn't using normal zig and there was drama about upstreaming. Combine that with anthropics desire to show they can help rewrite everything in rust and that probably accounts for some of it.
    • kristoff_itan hour ago
      Bun has de-facto refused to use incremental compilation in Zig for ages. It got to the point where Jarred somehow seems to have forgotten that the feature exists.

      In any case Bun has already committed to the Rust slop switch, so it doesn't matter anymore.

    • ulbu2 hours ago
      bun seems to be committed to slop rust already. so, with their ethic, maybe we should just disassociate them from zig and let them go realize their slop dreams?

      zig is on its way to improving compilation times in its own pace and does so for the benefit of the project and everyone involved, so what is left to care for about bun by anthropic’s past?

      • NewsaHackO10 minutes ago
        > bun seems to be committed to slop rust already. so, with their ethic, maybe we should just disassociate them from zig and let them go realize their slop dreams?

        Closing your eyes and pretending a problem does not exist is the a good solution. The fact of the matter is one of the biggest projects that used Zig thought that the devX was so bad that they opted to rewrite their entire 1M LOC project into a different language. This is a nightmare scenario for most companies, and will motivate similar sized companies/project to pick another language that will not require this than to risk using Zig. Also, Zig’s flippant attitude about Bun’s request (among other viewpoints) only further adds to why bigger projects would want to stay away from Zig.

      • jgalt21227 minutes ago
        I bet they'll ultimately reverse course on this, or the there will be a bun / zig fork becomes the de facto bun. Despite what the influencers say, I'm convinced you cannot vibe code a conversion this big. It will need a ton of human intervention. And for brand narrative reasons, Anthropic won't commit to such a path.
        • galangalalgol21 minutes ago
          It depends on how thorough the test infrastructure is I think. Something like curl with its immaculate tests could probably get autonomously ported if you threw infinite tokens at it because you have deterministically defined what finished looks like. But I think you are likely right in this case.