2 ms·
I'm happy to see Zig moving along. I've been using my extra spare time the last couple of weeks to play with it and it's been fun. Documentation is still sparse
by zamadatix 7y ago
I'm happy to see Zig moving along. I've been using my extra spare time the last couple of weeks to play with it and it's been fun. Documentation is still sparse but there is a whole lot more of it both in general and on the stdlib (zig test cases code is still the best place to figure out the stdlib IMO). Some things just feel "right" without having to give up access to the memory; a good example being arbitrary width integers being used in packed structs to create file/network headers without having to manually bit-twiddle every 4 bit field. Cross compiling is really as easy as it says on the tin and the standard library isn't afraid to include things like net and unicode but at the same time doesn't feel like it tries to throw the kitchen sink in too.
Unfortunately it is still very much the 0.x the name implies. Taking the above example defining 2 u129 or larger and trying to multiply them results in an error while compiling about it not being supported yet. Packed struct items that cross word boundaries result in a broken struct that contains a size larger than the data (which breaks pretty much all code that tries to use it due to size/type checking). Also due to comptime being as big of an idea as it is not everything works quite yet like const example: f64 = std.math.sin(4) * std.math.sin(2) being a compile time error since sin isn't defined for comptime floats yet.
Like I said it's definitely fun to play with but it's still quite a few releases away from "is this a compiler bug or did the documentation skim over something I'm just supposed to know" no longer being a problem so if that's not your cup of tea best to just watch the release notes over the next year or two.