Hacker News new | ask | show | jobs
by ayhanfuat 704 days ago
How was the Zig experience? I am looking for an intermediate Zig project to practice Zig. Does this require advanced features of Zig?
2 comments

I’ve also ported the lox vm to Zig and had a great time working through it.

Since the project is designed in C, you can mostly write the exact same code in zig, with minimal modifications. If you want to use zig features, they’re easy to integrate, but Nystrom obviously won’t be giving you any hints.

But the language offers a lot of useful features (slices, optionals, error types) and makes some C paradigms syntactic realities (tagged enums, explicit pointer casts). Even more so, the standard library comes with very useful stuff (an ArrayList, a handful of different allocators, heck I replaced the trie of keywords with a StaticStringMap).

it’s a fun project, I would definitely recommend it!

I’m also implementing it in Zig right now (and haven’t done any project other than small snippets in zig before) and it’s fine.

You can actually appreciate how much nicer it is to write than in C, while still being a fairly 1-1 translation.