← Back to context

Comment by lerno

7 days ago

As the author, let me add something beyond the comparison. Zig and Odin are very different languages, Odin is – as its slogan goes - "for the Joy of Programming". Zig on the other hand doesn't feel that this is a goal. From what I can tell Zig fans like to wrestle with the features of Zig to figure out how to fit their solutions within the constraints of the language. A mental challenge, similar to that of fighting the borrow checker in Rust. People who "figured out" Zig tend to be fiercely loyal to the language in a similar way as Rust evangelists to Rust.

C3 has a lot in common with Odin, but very little in common with Zig.

C3 has a slightly different feature set than Odin (e.g. more compile time execution, has methods, contracts, but doesn't have Odin's matrix programming and more extensive runtime reflection), but the goals aligns strongly with Odin's.

If you prefer C syntax and semantics you might like C3 better, but Odin is a fine language too.

Just to be clear, I don't mean the description of Zig to put down the language or the community. It's the best I can do to describe the difference between Zig on one hand and Odin/C3 on the other.

A more concrete example that might explain it better is looking at Advent of Code solutions.

One thing that struck me was that doing typical tasks for parsing would be 2-3 functions stringed together in a smart way in the Zig solutions, whereas in Odin and C3 it was achieved by having a single standard library function that did these steps.

From what I understand, there is a pushback against creating convenience functions in the Zig standard library, if the same thing can be achieved by stacking together a few functions.

My understanding is that doing these smart things with the Zig library with the existing functionality of considered a cool way to leverage existing code.

In C3, and I feel Odin as well, the lack of such a convenience function would be considered an omission to patch, and that having to stack things together should be reserved for specialized solutions, rather than having to stack things together for everyday tasks.

Thus in C3 and Odin, it is okay to trade detailed explicitness for convenience, whereas this is a no-no in Zig.

But what this means is that Zig users tend to celebrate and focus on smart and clever code, whereas this is a complete non-goal in C3 and Odin.

I could probably have formulated this better before.

  • In other words, Zig is closer to the original C and maybe Scheme, while C3 and Odin tend towards maybe Ruby (while of course remaining capable of doing low-level stuff). Correct?

    • Back in the day when C's closest competitor was Pascal, C wasn't particularly hard to use. Pascal was easier for manipulating strings and C better at doing low level data manipulation.

      But at the time there was little need for high level abstractions, and it was fine to just allocate an array with N number of entries and that was the maximum the program allowed.

      Today we're dynamically allocating memory with intricate relationships, especially in object oriented programming.

      This makes C look really hard to use – but it can actually be much improved with just an improved string library and a good dynamic array.

      But there are also cross platform concerns for things like networking and here C offers little to help.

      Regardless whether you're using Zig, C3 or Odin you're going to have a much easier time than C with straight up libc.

      So I think a better comparison is that Zig is a bit like using the C++ containers. If you've ever struggled to mutate a std::vector while iterating over it, you know it's a bit complicated to figure out exactly what functions fit where.

      The final solution might be performant, but it's a lot more to remember than say `iterator.remove_element()` that you might encounter in some other language. However, it does offer more ways to tweak it, and it's very explicit in what happens.

    • I have found C3 to be a generally simpler experience than Zig, it's fun to use while being low level. The general approach is aiming to be easy to use, personally I often compare it to Go philosophically but with more similar use cases to C and lower level.

> People who "figured out" Zig tend to be fiercely loyal to the language in a similar way as Rust evangelists to Rust.

This is very much not productive and you’re now part of spreding this narrative. There’s plenty of people out there who has «figured out» and appreciate both Zig and Rust without becoming attached to it.

I’m interested in communities which looks towards other languages for inspiration and admiration, not judgements and alienation.

  • For what it's worth, I found the Zig community on the biggest Zig discord very nice and welcoming. But that said, there is a lot of "you have to understand Zig" sentiment. Also, there is a lot of "I discovered Zig and it's finally showing me how to program" echoed as well.

    I don't find this an unfair judgment but rather an observation.

    I think this naturally arises from the language claiming to be "a programming language designed for robustness, optimality, and clarity" (See for instance https://www.recurse.com/events/localhost-andrew-kelley)

    If you feel that this is an optimal programming language that gives more robustness and clarity than other languages, then it's natural to be preachy about it.

    This is similar to Rust being sold as safe language, where similarly the proponents of Rust feel that the advantages of Rust need to be spread.

    As a contrast, Odin focuses on "joy of programming" as its main goal, and the author does not make any claims of the language having killer features to choose it over something else.

    However, it seems to be successful in that new users tend to remark how pleasant and fun it is to program in the language.

    • You're kinda proving my point here by using such loaded terms. You've chosen the term "preachy" (a negative word) to describe people who are excited about advancements in programming languages (e.g. borrow checker, powerful type system, comptime, alignment as a part of type system). You've chosen to not mention that Rust keeps being the "Most loved programming language" (according to Stack Overflow); isn't this is a sign that people find it joyful?

      > Also, there is a lot of "I discovered Zig and it's finally showing me how to program" echoed as well.

      So, did you try Zig? How did you find it? Did it show you a new way to program? Or were you already aware of this way? Or do you think it's not a good way? What did you find interesting? What features did you steal because they were good? What do you think is overrated? These are the questions I'm interested in from other programming language designers!

      > As a contrast, Odin focuses on "joy of programming" as its main goal, and the author does not make any claims of the language having killer features to choose it over something else.

      And that's a fair thing to say! You can say that C3 is just a slightly better C and doesn't have any other killer feature. I'm just not sure why you need to talk negatively about other languages.

      2 replies →

    • You can find a lot of the "showing me how to program" sentiment is common among people who learn Lisp/Clojure, Haskell, Erlang/Elixir, APL (oh, I mean, Numpy and Spark), and any other language that significantly differs from what you're used to. In the same vein, C is often a revelation for those who cut their teeth tackling JS and Python.

      Indeed, Zig has interesting features that make you think in ways you won't make when using C, like an ability to offload large amount of computation to comptime code, or using different allocators at different times (super simple arena allocation per a game frame, for instance).

      "A language that's not changing the way you think about programming is not worth knowing."

  • This is a good point about narrative spreading, in addition to marketing. People can become evangelized by their use of certain languages or by comments from certain language creators, then go on to attack others for using or even just wanting to try other languages. This shouldn't be what HN is about. It makes it look like HN has a language approval list.

    As for both C3 and Odin, they've been around for many years, yet don't even have a Wikipedia page and have relatively low numbers on GitHub. That comes across as more time spent pushing or hyping on HN, than those languages being considered a truly viable alternative by the general public. Just weird, because you would think it should be the other way around.

    • Did you know that Wikipedia editors will aggressively remove Wiki entries about less known languages. There are already several wiki articles on Odin by various authors that have been removed over the years.

      Talking about GitHub numbers, we can look at VLang, which had an astronomical trajectory initially due to overpromising and selling a language that would solve long standing issues such as no manual memory management but no GC needed etc.

      Such viral popularity creates a different trajectory from organically growing word of mouth such as in the Odin case.

      Vlang also has a Wikipedia page.

      Is this then proof that it is a viable alternative to the general public? This is what you argue.

      3 replies →

    • I don't think I'd use popularity-contests like Github stars or the presence of a Wikipedia page to judge a language's popularity or future prospects.

      2 replies →

  • So which language do you use then? I've never seen a language that doesn't have bad things to say about other languages. Zig bdfl himself accused vlang of committing fraud a while back.

    Every language designer takes things they like about some languages and leaves things they don't like.

    • > I've never seen a language that doesn't have bad things to say about other languages.

      That's why I said "communities" and not "languages". Every programming language has a wide set of people who use it. You can always find some people who constantly say bad things about other languages. You can also find people who are interested in the different trade offs of the language. I use languages which are technically interesting, and then I engage with the parts of the community which are interested in finding the best solutions to actual problems.

      And guess what? Most of the Zig and Rust community are, in my experience, way more focused on solving real problems than to push their language at all cost. Both /r/rust and /r/zig will often recommend different languages. I mean, this was the most upvoted comment around how to convince someone's boss to use Rust over Python: https://old.reddit.com/r/rust/comments/14a7vgo/how_to_convin....

      1 reply →

    • > Zig bdfl himself accused vlang of committing fraud a while back.

      I think there's a difference between a critical generalization of a community and the mindset behind it and how that relates to the language (without weighing in on how legitimate that criticism is), and a direct accusation that one individual did a specific bad thing.

    • > Zig bdfl himself accused vlang of committing fraud a while back.

      That was truly foul. On top of that, begged readers to give their money to Zig. Clearly some have no limits on what to say and do against other languages or to sell their language.

      That's why whatever bad things a creator or evangelist says about another language, people shouldn't just swallow, and instead take with a grain of salt and some skepticism.

      3 replies →

On ziglang.org the very first thing we advertise is:

> Focus on debugging your application rather than debugging your programming language knowledge.

Clearly, you think the language fails at this criteria (your subjective opinion). Please be honest and say that, rather than implying that it's not explicitly one of the core design principles of the language (objectively false).

  • a little good faith and a little less grump would go a long way. not the first, nor second time you’re being harsh on your peers for no apparent reason, reading shit into what they say in a most inhospitable way, presenting yourself as some clairvoyant into intentions of others. it’s just not healthy, man. no one’s attacking you or your precious visions here.

    it’s not at all “clear” from the comment that the author thinks what you say he does. what was said in the original comment aligns well with zig’s “only one (obvious) way to do things” and its explicitness. other languages offer a much broader vocabularies, higher-level overlapping toolsets, while zig is much more constrained and requires the user to do the work herself, hence “Zig fans like to wrestle with the features of Zig to figure out how to fit their solutions within the constraints of the language”, which is an objective fact.

  • (Funny story, I seem to have a bout of visual migraine at the moment and misread your comment until just now and had to remove what I wrote).

    I didn't mean to give the impression that I'm putting down Zig. It's more that I've noticed that people tend to frame problems differently with Zig than with Odin.

    To explain what I mean by framing, consider OO vs procedural and the way OO will frame the problem as objects with behaviour that interact, and procedural will frame the problem as functions being invoked mutating data.

    The difference isn't at all that stark between Odin and Zig, but it's present nonetheless. And clearly Zig is doing something which a lot of people like enjoy. It's just that the person using Zig seems to enjoy different aspects of programming (and it seems to me be in the spirit of "the challenge of finding an optimal solution") than the person using Odin.