‹ BackHN Continuity

Thread

What Zig felt like, coming from Rust

282 points · 351 comments · ksec

  1. tialaramex · · focus · HN ↗
    I think when we're looking back on the 2020s we'll be struck by the Allocator obsession

    All of the Handmade "C successor" languages seem to have this obsession, including not only Zig but Odin, C3 and Jai.

    For some toy problems you can do clever allocator tricks and get a huge perf win. For example Jai and Odin both seem to really want you to write code which can throw away a "per-frame" arena periodically so they're not paying to track allocations in the arena because they're all thrown away at the same time.

    But a lot of real world software just isn't that simple. This doesn't make such features worthless, it just means they're one of a thousand tools the experienced developer could want in their toolkit, not really deserving headline status.

    1. lerno · · focus · HN ↗
      The C3 temp allocator leans into this though. It’s not a frame allocator but acts like a stack allocator. It solves the ”oh, how do you make sure the data you got back is properly freed”. In Zig you need to create and free arenas by hand, which is not far from freeing the returned allocations by hand.

      But I think C3 shows it can be taken further.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.