‹ BackHN Continuity

Thread

What Zig felt like, coming from Rust

282 points · 351 comments · ksec

  1. gigatexal · · focus · HN ↗
    “ The language is different from Rust (who could’ve thought that, yeah), but it left a genuinely good impression. It’s straightforward, modern, and blazingly fast. I believe it has real potential to become the true successor to C. On the other hand, it’s still young, and it shows: the shape of the language itself feels unfinished in places, and I suspect it’ll pick up more of the cooler quality-of-life features and syntax sugar as it matures.

    As for me, I’d like to keep contributing to the ecosystem, and I will, whenever I come across a project worth building.”

    Idk I don’t write either well enough to have a hand in this but losing out all of this for more Imperative stuff seems like a step back.

    “ No functional paradigm

    Rust is technically an imperative language, but it draws heavily on functional concepts: zero-cost iterators, lazy evaluation, ADTs, pattern matching, monadic types, traits, closures, and so on. Having also spent time with Haskell and Erlang, I’ve become fairly inclined toward the functional style, and it shows in this library. It leans heavily on FP idioms:

    Monadic error control via combinators like Queryable and related types Monadic-style data types like Data<T> with map, flat_map, reduce, and friends Pure, immutable transformations Combinators over iterators instead of loops Closures for local abstraction Declarative macros as a small embedded DSL Sum types and product types”

    1. cosmic_cheese · · focus · HN ↗
      I’m more than a bit out of my depth discussing the topic, but I’m not sure than imperative-dominant languages will ever really go away or that functional-dominant languages will ever become as popular as C and C++. Ugly as they may be, imperative languages seem to be grokked by humans more readily and are more often than not “good enough” for the most part so it’s difficult to see them losing substantial momentum.
      1. pyrolistical · · focus · HN ↗
        Until there is a machine that is natively functional, there is always going to an incentive to go lower level for more performance.

        Even hardware (GPUs) that functional language could trivially exploit, it’s still higher performance to write low level code and manages all the memory imperatively

      2. ModernMech · · focus · HN ↗
        I think you’re right about people, but by volume, 99% of all future code will be written by machines. So there’s ample opportunity for other languages to flourish; if humans can’t get past imperative programming, machines can.
        1. cosmic_cheese · · focus · HN ↗
          In my mind this hinges on whether LLMs become capable of actual comprehension of the code they’re writing. If not, for serious projects (especially those which are mission-critical), it still makes sense to optimize for human understanding when selecting languages so the code can reasonably be verified.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.