News for hackers. Stuff that matters.
Re:Zig 0.4.0 Released by dmix on Monday April 08, 2019 @09:41PM (#19610933)
[Off-topic] Another programming language website with no code examples front/center on the homepage?

When you click "Download & Documentation" there's a link under the headline "master" to the long-form documentation which has some examples: https://ziglang.org/documentation/master/

Edit: also found a blog post with a nice introduction: https://andrewkelley.me/post/intro-to-zig.html and an examples directory: https://github.com/ziglang/zig/tree/master/example

Interesting to see how the language has evolved away from using "%" in the original Hello world:

    const std = @import("std");

    pub fn main(args: [][]u8) -> %void {
        // Print "Hello World!", and believe that no errors will happen
        std.io.stdout.printf("Hello World!\n") %% unreachable{};

        // Short version:
        %%std.io.stdout.printf("Hi!\n");
    }
Compared to the newer version :

    const std = @import("std");

    pub fn main() !void {
        // If this program is run without stdout attached, exit with an error.
        const stdout_file = try std.io.getStdOut();
        // If this program encounters pipe failure when printing to stdout, exit
        // with an error.
        try stdout_file.write("Hello, world!\n");
    }
Re:Zig 0.4.0 Released by daurnimator on Tuesday April 09, 2019 @03:28AM (#19612527)
Looks like someone just filed the lack of samples as an issue: https://github.com/ziglang/zig/issues/2218
Re:Zig 0.4.0 Released by manaskarekar on Tuesday April 09, 2019 @09:21AM (#19614278)
My favorite website for an example of this functionality is: https://dlang.org/.

Succinct examples on a clean page, no fluff.

Re:Zig 0.4.0 Released by Thaxll on Tuesday April 09, 2019 @09:41AM (#19614487)
Yes, the homepage for Go is similar https://golang.org/