A community for the zig programming language https://ziglang.org/
🌉 bridged from !zig@programming.dev by Tidepool
A community for the zig programming language https://ziglang.org/
🌉 bridged from !zig@programming.dev by Tidepool
I got got
I'm recovering from getting my wisdom teeth removed and decided to finally learn Zig to kill some time. Started up Ziglings and everything was completely smooth until the Exercise that had Error Unions. Couldn't figure out for the life of me why I was getting an Error for doing exactly what the exercise taught me to do though!!
var my_number: u8|MyNumberError = 5;
I tried reading the error messages, checked if maybe my zls version was set to something wrong, checked the ziglang changelog if maybe the syntax changed between v16 and v17, checked the Issues tabs on the Ziglings git to see if anyone else had this issue, and then re-checked the zig documentation on my phone just to realize:
The Error union type is supposed to be defined with an exclamation mark (!) instead of a pipe (|), I was just misreading it because I'm not wearing my glasses! And I guess I'm used to seeing pipes used in types because it's common in TypeScript haha
I wrote my first zig program
I need to boast a bit and ask for "code review". I'm sorry if this doesn't constitute a good post. I browse local communities more often than I should for my mental health. I was checking out https://nim-lang.org/ and when I googled it one of the links was to rosettacode.org and I decided to check out the implementation of 2048. I noticed that zig's implementation was a non-working auto translation of rust's, so I decided to rewrite it. My repo: https://codeberg.org/Vulwsztyn/2048_zig With the reader, writer, and arraylist api changes in 0.15 most of the sources were usless and if I hadn't found https://github.com/xyaman/mibu I guess I would have surrendered. Feel free to roast the hell out of my code.
Zig 0.15.1 Released
Debug compilation is 5 times faster with Zig's x86 Backend selected by default; the work-in-progress aarch64 Backend hot on its heels. Meanwhile, the Writergate scandal, along with a slew of Language Changes and Standard Library cuts, rocks the boat with tidal waves of breaking API changes; the harbinger of async/await resurrection; the last bastion defending language stabilization.