From d26d6de75968e094e30a46900dc44719992ca45c Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Tue, 14 Feb 2023 19:15:31 +0100 Subject: [PATCH] Next video: new ideas. --- zig-impl/next-video.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/zig-impl/next-video.md b/zig-impl/next-video.md index 8cdbdc1..cb33cd6 100644 --- a/zig-impl/next-video.md +++ b/zig-impl/next-video.md @@ -24,6 +24,10 @@ receive_fd send_fd +# switch + +An example of `catch |err| switch(err)`. + # Test stuff zig test src/main.zig @@ -36,6 +40,22 @@ servedoc: darkhttpd docs/ --addr 127.0.0.1 --port 35000 --log $(ACCESS_LOGS) +### Frustration + +Searching for a type, this type depends on a sub-type, which depends on the OS, which ultimately... cannot be documented automatically. + +Example: + + std.fs.File.Mode => const Mode: "mode_t" = os.mode_t; + os.mode_t => const mode_t: "mode_t" = system.mode_t; + +### anytype + + // create a server path for the UNIX socket based on the service name + pub fn server_path(self: *Self, service_name: []const u8, writer: anytype) !void { + try writer.print("{s}/{s}", .{ self.rundir, service_name }); + } + # Errors Double returning type => no need for specific return structures.