4 ms·
casting, one of the reason i gave up with Zig quickly, it just is painful and solves nothing, it makes the code hard to decipher
by Shadonototro 5y ago
casting, one of the reason i gave up with Zig quickly, it just is painful and solves nothing, it makes the code hard to decipher
- losvedir 5y agoHow quickly? Like, you saw it in the docs when you were mildly interested and decided it wasn't for you? Or you started a project, had at least a "hello world" compiling, but then eventually gave up on it because you were tired of casting? In that case I'm curious what the project was since I haven't run into casting all that often, but it might vary by domain.
- dnautics 5y agoi just looked over some code I have which takes a complicated 3rd party binary format, parses, and extracts information from it. In about 2K LOC including tests there are no casting events except for some int-to-pointer and pointer-to-int at the boundary of passing reference to WASM.
- Shadonototro 5y agoIt was a while ago, a game engine, it just feels bad, maybe i misused the language, but that is a sign things aren't intuitive Some people love typing code like they'd write books, i don't, i like to be concise and to go straight to the point And it's not just as(i32) intToFloat(f32) floatToInt(i32), and then between i8 i32 i64, and then bitwise operations, and then slices, and then C strings etc etc etc, lot of visual bloat
- AnIdiotOnTheNet 5y agoI like it because it provides explicitness and readability. There is no guessing or following a flow chart of implicit type conversions to see what's going on.