summaryrefslogtreecommitdiff
path: root/notes.org
diff options
context:
space:
mode:
authorNate Cox <nate@natecox.dev>2026-06-17 18:37:14 -0700
committerNate Cox <nate@natecox.dev>2026-06-17 18:37:14 -0700
commit1aa1c0231c9129d2b361d6c21558a8dd1d508e82 (patch)
tree5124ceded3f00e6c6d9114bd19a861b8297b218a /notes.org
downloadzig-book-1aa1c0231c9129d2b361d6c21558a8dd1d508e82.tar.bz2
zig-book-1aa1c0231c9129d2b361d6c21558a8dd1d508e82.zip
Chapter one
Diffstat (limited to 'notes.org')
-rw-r--r--notes.org56
1 files changed, 56 insertions, 0 deletions
diff --git a/notes.org b/notes.org
new file mode 100644
index 0000000..9653181
--- /dev/null
+++ b/notes.org
@@ -0,0 +1,56 @@
+* 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 ~test~ as a keyword rather than a module. [[file:hello_world/src/main.zig::test "simple test" {][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. [[file:hello_world/src/main.zig::fn testOne(context: void, smith: *std.testing.Smith) !void {][example]]
+- It is kinda neat that you can ~try~ without 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
+ #+begin_quote
+ I personally think that, the best way of reading Zig code is to read
+ the source code of the Zig Standard Library.
+ #+end_quote
+- zig.news being down is weird, wonder what happened there?
+** 1.4
+- Don't like that ~var~ is mutable by default. Really do prefer
+ default immutability.
+ - Yeah I know I can ~const~, but it's the principle.
+** 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~?
+ #+begin_src zig
+ 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();
+ }
+ #+end_src
+- 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:
+ #+begin_quote
+ In the example below, we loop through the japanese characters “アメリカ”.
+ #+end_quote
+- 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?