Hi everybody. Coming from rust. I really like zig's philosophy but i'm struggling with a lot of common patterns
I'm looking for a big project which i could break down from the start to learn about those things. It will take a lot of time and that's why i'm asking for your opinions.
Currently i'm looking into tigerbeetle but i'm not really sure if that's what i should to read in order to understand and the project itself is massive
#What's the best project to break down for learning?
1 messages · Page 1 of 1 (latest)
Zig's std
If you want example for interfaces: std.Io.Reader
Basic networking: std.http
i was looking for something written in zig from the start. I want to try backtracking commits and reading through them instead of looking at the final state
Zig's std is super readable, so idk why you should look "from the start".
There's #1024381264213594242, check it out!
it's because i don't know where to look at. But the Reader one is definitely useful. Thanks for guide🙏
Also, I was Rust programmer too. I want to give some tips before you continue.
- Always write unit tests, because they catch 99.9% of memory bugs with
std.testing.allocator - Keep in mind that most of
stdtypes are "views". So if you need to store anything you should copy it to the stack or do heap allocation. - Always use
defer/errdeferif something could fail. - If possible, always do
comptime. zig zen
@proud stirrup
Thank you. That's really nice!
What do you mean by std types?
I think i get what you mean. So some types operate on view into some data which is located somewhere else in memory. Correct?
And as far as i can see splitScalar doesn't copy but uses original slice
@daring sand
Yes
I felt into that many times
Silently corrupting the memory
Ohh i see. That's helpful. Thank you for tips