I have been reading about this new language for a while. It’s a C competitor, very slim language with very interesting choices, like supporting cross platform compilation out of the box, supports compiling C/C++ code (and can be used as a drop in replacement for C) to the point in can be used as replacement of ©make and executables are very small.

But, like all languages, adoption is what makes the difference. And we don’t know how it goes.

Is anyone actually using Zig right now? Any thoughts?

  • Vorpal@programming.dev
    link
    fedilink
    English
    arrow-up
    20
    arrow-down
    1
    ·
    1 year ago

    I really don’t see what niche it is trying to fill that isn’t already occupied.

    Rust is as successful as it is because it found a previously unoccupied niche: safe systems programming without garbage collector and with high level abstractions that (mostly) optimise away.

    I don’t think “better C” is a big enough niche to be of interest to enough people for it to gain a critical mass. I certainly have very little interest in it myself.

    • jeffhykin@lemm.ee
      link
      fedilink
      arrow-up
      11
      ·
      1 year ago

      The killer feature (IMO) is automatic conversion of C code to Zig code (transpiling). E.g. take a C project, convert it all to Zig, and even if you don’t transpile, you still get really nice compat (include C headers just like a normal input without converting). Getting a medium sized C project converted to Zig in 1 day or 1 week, then incrementally improving from there, is really enticing IMO especially considering the alternative of rewriting in Rust could be months of very hard conversion work. Transpiling isn’t perfect but it seems to be a 97% soltuion.

      The second advantage seems to be easy unsafe work.

      BTW I don’t really use Zig, and I still prefer Rust, but those are the reasons I think it has a niche of its own. Does rust already fill this space? Yeah kinda, but that’s why I’d call in a niche

    • voxel@sopuli.xyz
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      1 year ago

      comptime is a huge killer feature for me. I used it to generate ARM lookup tables at compile time and it’s amazing, it also removes the need for generics as types are just arguments
      for example the Vec function accepts a type as and returns a struct that can hold arbitrary amounts of said type on the heap.
      I eventually switched to rust + proc macros tho (zig solution was MUCH cleaner!) because both ZLS and the Zig compiler are terrible and still needs a lot of work.

    • philm@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Yeah my thinking as well.

      Addtionally, why I think other system language competitors like Zig or Nim aren’t succeeding long-term, is because of fast growth and already big ecosystem of Rust. Zig may be better though for some use-cases (when you want to avoid all the mental overhead, and the application stays simple).