logoalt Hacker News

Arch485today at 5:36 PM2 repliesview on HN

It is. I definitely agree that strings in Zig can be tedious, but the upside is that if you need it, you can build a string library that does everything you want it to do, in the way you want.

For comparison, while Rust offers a very rich string library, it's also very strict about what you can/cannot do with strings, so if your use case falls outside of that you're out of luck. With Zig, you can pretty easily roll your own and make it do what you want. (and when Zig is post 1.0, I imagine there will be some very nice pre-made string libraries by the community etc.)


Replies

ngrillytoday at 6:53 PM

But I don't think you can implement RAII in Zig?

steveklabniktoday at 6:17 PM

You can also roll your own strings in Rust just fine. Take the bstr crate, for example.