crowhack | 3 years ago | on: The Ethereum merge is done
crowhack's comments
crowhack | 5 years ago | on: Why Zig when there is already C++, D, and Rust?
crowhack | 5 years ago | on: Why Zig when there is already C++, D, and Rust?
You can use defer keyword to free right after allocating and it won't be called until the function/program completes. You can use debug or testing allocators to ensure no memory is left unfree'd or double free'd. The std lib has a large selection of custom allocators that you can use depending on your needs. One great one is an "Arena Allocator" which is just a linked-list of allocations that can be free'd at one time, versus tracking all these individual allocations. And if none of these allocators fit your needs, the interface to define one is pretty easy to implement. https://ziglang.org/documentation/0.7.1/#Choosing-an-Allocat...
"I'm not mutating or holding onto anything I'm not meant to"
Not really sure Zig can help you with this one. With great power comes great responsibility, or something like that.
"that I've accounted for every exception that I can result from a given call"
Zig does not have exceptions, but it does have error types which functions can return. From the function definition you usually can determine all the errors that can possibly be returned, unless the function definer use'd the catch all ! error type. Regardless, it is still much better than regular exceptions because
- you know by the function def that an error could be thrown, the compiler forces the caller to account for a possible error by "unwrapping" the return value
- an error happening just passes back a different type to the caller and in combination with the above, you can never "miss" an error https://ziglang.org/documentation/0.7.1/#Errors
Also Zig switch statements without an else ensure you handle every possible value so if you forget to handle one possible error (based on the type), it will throw a compile error. https://ziglang.org/documentation/0.7.1/#toc-Exhaustive-Swit...
crowhack | 6 years ago | on: Game Boy Advance “Hello World” Using Zig
0.5.0 Documentation https://ziglang.org/documentation/0.5.0/#Introduction
root std library https://github.com/ziglang/zig/tree/master/lib/std
examples of writing and reading to a file https://github.com/ziglang/zig/blob/master/lib/std/event/fs....
There are also a ton of projects that the creator has done with Zig, you can check those out for more examples as well.
https://github.com/andrewrk?utf8=%E2%9C%93&tab=repositories&...
Looks like he has an advent of code repo too.
crowhack | 7 years ago | on: Show HN: Strife, a 2D game library for Go
crowhack | 7 years ago | on: Show HN: Strife, a 2D game library for Go
crowhack | 7 years ago | on: Show HN: Strife, a 2D game library for Go
crowhack | 7 years ago | on: Show HN: Strife, a 2D game library for Go
Any examples of this being used for something non-trivial? I'm generally curious because I figured Golang would be a no-go due to the GC...
crowhack | 9 years ago | on: Racket v6.8
crowhack | 11 years ago | on: Omnisense - Join the new humanity
crowhack | 11 years ago | on: Show HN: Tool to turn your HTML into a collapsible tree
crowhack | 12 years ago | on: The Eudyptula Challenge
crowhack | 12 years ago | on: From a Frat Social Network to a GPU Compiler for Hadoop
crowhack | 12 years ago | on: Show HN: Dpadd, Goodreads for games, is now open to all
For the past couple years I've been using http://www.backloggery.com/ to keep track of what I am playing.
crowhack | 13 years ago | on: Microsoft looking to release Office for Linux in 2014
I can't fully understand why I find this so funny but I am just falling out of my seat laughing.
While I find this extremely comical, I am excited to see the consequences of this for desktop linux. The way I see it, the more people who use linux the better it will become :).
crowhack | 13 years ago | on: Netflix releases House of Cards
edit: here it is http://lifehacker.com/5963726/netflix-finally-comes-to-ubunt...
crowhack | 13 years ago | on: Netflix releases House of Cards
crowhack | 13 years ago | on: Netflix releases House of Cards
crowhack | 13 years ago | on: C++ Grandmaster Certification
crowhack | 13 years ago | on: Google-Asteroids – Arcade Style Search
Cool idea though!