1. 49
  1. 39

    Zig is a language with manual memory management and no runtime, like C.

    This is your obligatory reminder that C does in fact have a runtime. C is just in the enviable position that its runtime has been folded into the Unix operating system API. On an OS that is not as C-centric, this distinction is more visible.

    1. 7

      Even on a unixalike crt0 is there, lurking, doing things like populating environ and calling main.

      1. 9

        The original framework - don’t call us, we’ll call you.

        1. 4

          Have you heard about the popular DI framework LD?

      2. 5

        Yup anyone remember msvcrt.dll ? (presumably this still exists, but thankfully I haven’t seen it in ages)

        1. 1

          It’s Complicated™ as MS tends to alternate between versioned CRT and universal unversioned CRT - that, and you can statically link it, but unlike a Unix, it doesn’t matter because the system libraries don’t involve the CRT.

        2. 5

          In fairness, c can be used without a runtime

          …but so can many other languages.

          (I’m not counting libgcc; it’s an implementation detail.)

          1. 2

            …a few other languages, at least.

        3. 27

          I’m keeping both eyes on the development and evolution of Zig. As I become older — I’m a couple years shy of 40 — what I value in a programming language, and in my tools in general, is shifting. As a young 20 year old, I valued expressivity above all else: languages like Common Lisp, Smalltalk, and Ruby were what I craved. In my thirties, I’ve valued safety and performance and languages like OCaml and Rust have been great tools to use.

          I recently became a step-father and a dog owner and I have a lot less free time to keep up to date with the newest developments in Rust-land. (I haven’t even tried doing an async program yet!) As a result, I find that I now value simplicity a lot more. I’m looking for tools that I can learn quickly, keep how they work in my head without too much trouble, and get a lot of bang for the buck. Zig fits that description and I’m finding myself more in agreement with their community’s core values than Rust’s. Not sure if I’ll ever be a Zig developer, but my eyes are open and so is my mind.

          1. 11

            I think one of the amazing things about zig is that the language is tight and guessably consistent:. If I don’t know how to do something I can usually guess; and if I ask usually it’s like “oh yeah of course thats how you would do it”. That’s very powerful, difficult to quantify, and more relevant than you would guess.

            1. 7

              I recently became a father and I’m getting up there in years too (still a few from 40 though), and I’m not having any problems “keeping up” with Rust personally. And because my time is so limited, I really appreciate how Rust is able to catch a lot of mistakes that I might otherwise make while I’m coding in a sleep deprived state. It gives me confidence and lets me move more quickly because the compiler helps relieve a lot of my mental burden.

              Zig might do that too. I don’t know, haven’t tried it anger yet.

              (For me personally, I don’t think “age” really has much to do with anything here, but I’ve framed it this way because that’s what you did, and I think counter-experiences are valuable.)

              1. 2

                I recently became a father

                Congrats! Me, too, back in January. Hope you’re figuring out the whole work life balance thing. That’s been a real challenge for me and I’ve had to cut back on side projects (and trying out Zig as much as I’d like). But I’m hopeful once this creature is a little more self sufficient I’ll have some time. I also recently worked out a 4 day workweek, so might get some nap time to tool around, too.

                I know you have a ton of crates you maintain and post incredibly long and detailed and informative and useful comments and posts, but I’m hoping you let those fall by the wayside if need be!

                1. 2

                  Aye thanks. :-) Yes, I have a lot less time than I used to. My little guy was born in October. But yeah, I am also hoping my time will free up a bit more once he gets older. Right now it’s pretty intense. I still find a little time for coding in the evenings. Everything takes a lot longer!

                  And congrats as well! Good luck!

            2. 21

              NB: this is about zig, not about writing a programming language with zig!

              (For the record, if anyone has experience writing a language in zig and is interested in doing a write up, I would read it.)

                1. 2

                  Oh, thank you!

              1. 7

                I can rapidly see myself doing something like this in the future:

                Old and busted: C and Python

                New hotness: Zig and Go

                It’s not that I don’t love C and Python, I do, but Zig really captures what I would want out of “a better C” than any other language, and Go’s typing and deployment stories make it a good replacement for a lot of what I do in Python. Python would still be the “whip out a quick script” language for me for probably forever, but…I can see this change happening.

                1. 9

                  I don’t really see Go replacing Python. It fits somewhere in between Python and C, with it’s focus on concurrency and speed, while sacrificing some of Pythons ability to abstract things away effectively.

                  1. 5

                    My consistent experience is that Go is replacing Python for more or less everything, except maybe that space between a shell script and a proper program.

                    1. 8

                      Not numerical/modeling related code. We’ve tried doing that at work, but it slows development down way too much. So we ended up introducing a network boundary to talk to a Python process just so folks could iterate more quickly.

                      I personally don’t write that numerical code, and I was an advocate for keeping as much in Go as possible as a default state, but my colleagues made a compelling case.

                      1. 3

                        I feel like Julia has an outside shot at that, especially since grant Sanderson taught a course at MIT in it. In three years there will be a cohort of high-status CS college grads whose first PL was Julia.

                        1. 1

                          Maybe. Some of the modeling folks on my team do love Julia. I’ve never tried it and probably never will; I’m not really its target audience and its startup time (from what I’ve seen) is just a total non-starter for me. But yeah, I don’t have the domain knowledge to evaluate Python vs Julia for numerical/modeling tasks.

                          1. 1

                            To mitigate some of the startup time issues, https://github.com/dmolina/DaemonMode.jl is frequently recommend, but Julia is still a more niche language than Python in the scientific space which does make hiring and help more difficult.

                            1. 1

                              Yes, I’m aware of the mitigations (certainly at least at the theoretical level). They don’t work for the stuff I do. My users would not be happy if the CLI tools I shipped to them had to be run in a client-server mode with a daemon running. Like I said, I am not in their target audience. :-)

                        2. 1

                          Not numerical/modeling related code.

                          That’s true, Python (with NumPy) still owns that space, and also I guess a lot of adjacent academic spaces, too.

                      2. 2

                        Go would (and has started) replacing Python for me in the “high level application development” space.

                        For the quick script/speed isn’t a factor case, Python still reigns supreme for me.