logoalt Hacker News

dlcarriertoday at 8:40 PM3 repliesview on HN

I just looked up a Hello World program from the Zig Wikipedia article:

    const std = @import("std");
    const File = std.Io.File;
    
    pub fn main(init: std.process.Init) !void {
        _ = try File.stdout().writeStreamingAll(init.io, "Hello, World!\n");
    }
That's a lot to follow, just to output a plan-text message, especially after this line: "The primary goal of Zig is to be a better solution to the sorts of tasks that are currently solved with C. A primary concern in that respect is readability…"

Replies

jdlshoretoday at 8:44 PM

I don’t think you can judge a programming language based on its “Hello World.” AppleSoft BASIC has this:

10 PRINT “Hello World”

Beautifully simple and readable. But it’s not a good language by modern standards.

In your example, I see a lot of complexity being surfaced: output streams, locals instead of globals, error handling. I don’t know Zig but all of those are things that are important to address, and I like that the example doesn’t sweep them under the rug in pursuit of a false readability.

tester756today at 9:16 PM

Whats the point of evaluating technology from hello world programs?

defentoday at 8:42 PM

The issue is that most "hello world" programs are not correct.

show 1 reply