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?

  • CameronDev@programming.dev
    link
    fedilink
    arrow-up
    6
    ·
    10 months ago

    I wonder if owners of large C projects are that keen to move off C to zip though? I guess time will tell. I do a fair bit of C, and I can’t see us risking switching to Zig, unless there was something else that made it really worth it. I should probably have a look at Zig if I have spare time, maybe there is a killer feature we aren’t seeing yet.

    Easy interop with legacy code is how kotlin took off, so maybe it will work out?

    • Blackthorn@programming.devOP
      link
      fedilink
      arrow-up
      5
      ·
      10 months ago

      My understanding is that this is possible: you should be able to take a C project, add a build.zig file and under the hood the system is calling clang to compile the C project. HOWEVER, you can now add a .zig source file, compile that in zig and link together with the output of the C compiler into an executable. If this is actually true, I can definitely see the attractiveness of the language.

      • CameronDev@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        10 months ago

        Definitely sounds like a well thought out upgrade path. But I don’t feel like an upgrade path is a killer feature in of itself. I think I’d have to have a play with it to see if there is something to make transitioning worthwhile.

    • Aloso@programming.dev
      link
      fedilink
      arrow-up
      4
      ·
      edit-2
      10 months ago

      Easy interop with legacy code is how kotlin took off, so maybe it will work out?

      Good interop was a requirement for widespread adoption, but not the reason why programmers want to use it. There’s also null safety, a much nicer syntax, custom DSLs, sealed classes, type inference, data classes, named and optional arguments, template strings, multi-line strings, computed properties, arbitrary-arity function types, delegation, custom operators, operator overloading, structural equality, destructuring, extension methods, inline functions and non-local control flow, reified types, …

      Some of these features have since been added to Java.

      • CameronDev@programming.dev
        link
        fedilink
        arrow-up
        4
        ·
        10 months ago

        I wasn’t trying to diminish the value of Kotlin, my point was that interop makes it so easy to stealth insert it into legacy java codebase, and that probably contributed heavily to it’s success?

        Language adoption is a multi-part problem, you ideally need good interop (or upgrade path) and your language needs to also be compelling enough to upgrade to. Zig certain seems to have the former, I’m not personally sold on the latter, but it certainly sounds like it might have some compelling features.