diff options
Diffstat (limited to 'notes.org')
| -rw-r--r-- | notes.org | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/notes.org b/notes.org deleted file mode 100644 index 9653181..0000000 --- a/notes.org +++ /dev/null @@ -1,56 +0,0 @@ -* 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? |
