No description
- Zig 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| hello_world | ||
| .gitignore | ||
| README.org | ||
Chapter 1
1.2.1
-
Built in build tool is nice
- I have mixed feelings about the build tool taking in a build script, rather than using a toml/json/etc config file.
1.2.2
- Really like
testas a keyword rather than a module. example
1.2.3
- Using a bang to indicate a possible exception is interesting. Not sure if I love it, will need to play with it, but it's certainly terse. example
- It is kinda neat that you can
trywithout a follow up catch.
1.2.4
- Feels like a lot of commands to get a test. Gonna miss
cargo run.
1.3
-
No thanks
I personally think that, the best way of reading Zig code is to read the source code of the Zig Standard Library.
- zig.news being down is weird, wonder what happened there?
1.4
-
Don't like that
varis mutable by default. Really do prefer default immutability.- Yeah I know I can
const, but it's the principle.
- Yeah I know I can
1.4.4
- "you must mutate" feels like such a weird rule.
1.4.6
- Gonna be hard to go back to manually defining the size of
arrays.
[_]here I come.
1.7
- Labeled blocks are cool
1.8
-
Woah, is that really what you have to do to write to
stdout?const std = @import("std"); pub fn main(init: std.process.Init) !void { var stdout_buffer: [1024]u8 = undefined; var stdout_writer = std.Io.File.stdout().writer(init.io, &stdout_buffer); const stdout = &stdout_writer.interface; const string_object = "This is an example of string literal in Zig"; try stdout.print("{d}\n", .{string_object.len}); try stdout.flush(); } - Sentinel terminated arrays sound so academic. Given all the criticisms of how hard and complicated Rust is, with Zig as a frequent alternative, I am surprised to see how academic this feels.
-
Have feelings about the choice to use the word "America" as the katakana example:
In the example below, we loop through the japanese characters “アメリカ”.
- Feel like it's strange to put the string library functions into the memory std lib… but I assume that's because they're not actually string specific?