Live data from Hacker News

Zig 0.4.0 Released

ziglang.org

11–20 of 141 posts

Re: Zig 0.4.0 Released

#11
[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

#12
post #3

Zig's new release has a ton of improvements: new targets (e.g. LLVM 8, WASM, support tiers), C pointers, Vector type, better docs, and my personal favorite: Zig now makes things as static as possible by default. I love seeing all the progress with Zig, V, Muon, and Rust. All these languages are potentially-better systems languages than C/C++, with better safety, better definitions, and better semantics. Zig has an ex…

Isn't V fake? https://github.com/vlang/v

Re: Zig 0.4.0 Released

#13
post #3

Zig's new release has a ton of improvements: new targets (e.g. LLVM 8, WASM, support tiers), C pointers, Vector type, better docs, and my personal favorite: Zig now makes things as static as possible by default. I love seeing all the progress with Zig, V, Muon, and Rust. All these languages are potentially-better systems languages than C/C++, with better safety, better definitions, and better semantics. Zig has an ex…

Isn't V fake? https://github.com/vlang/v

I wouldn't call it "fake", but yes, it has not been publicly released.

Re: Zig 0.4.0 Released

#16
post #3

Zig's new release has a ton of improvements: new targets (e.g. LLVM 8, WASM, support tiers), C pointers, Vector type, better docs, and my personal favorite: Zig now makes things as static as possible by default. I love seeing all the progress with Zig, V, Muon, and Rust. All these languages are potentially-better systems languages than C/C++, with better safety, better definitions, and better semantics. Zig has an ex…

Isn't V fake? https://github.com/vlang/v

That's not particularly charitable. The accidental AMA that happened on HN a few weeks back gave me the impression that V lang isn't as polished as a concept as some of the other offerings out there. BUT the author seemed tp have something brewing. And regardless we'll have some more evidence in the coming months.

Regardless, V lang is another data point that something besides C is a possibility with the modern tools that we have available to us. Whether or not it pans out is almost immaterial. Just the fact that so many people are finding some sort of success or making some sort of progress in this space is enough for me to continue to watch for any new progress in the C competitors.

Re: Zig 0.4.0 Released

#17
I've played with it for a few hours now and it feels promising. But also very hard to get into. There is not a lot of documentation nor code examples to look at. I'm trying to write the equivalent of int main(...) { for (int i = 0; i Another small annoyance was Zig rejecting \r in line endings. Thankfully, I'm using Emacs so it only took me 15 minutes to google the right fix. But it felt a little "gratuitous" if you know what I mean.

Re: Zig 0.4.0 Released

#19
post #17

I've played with it for a few hours now and it feels promising. But also very hard to get into. There is not a lot of documentation nor code examples to look at. I'm trying to write the equivalent of int main(...) { for (int i = 0; i Another small annoyance was Zig rejecting \r in line endings. Thankfully, I'm using Emacs so it only took me 15 minutes to google the right fix. But it felt a little "gratuitous" if you…

Here is a repository with a few more small code examples which may be helpful: https://github.com/tiehuis/zig-rosetta

The code itself should be up to date for most, but I'm aware of a few examples than need touch-ups. Unfortunately there is a bit more boilerplate compared to other languages for some simple tasks, since Zig requires you to be quite explicit about things (e.g. i/o, memory allocation).

Regarding the rejection of '\r', there is the intention for `zig fmt` to handle these minor issues and reformat code as needed which hopefully reduces this barrier. There was a long issue regarding hard tabs with discussion here: https://github.com/ziglang/zig/issues/544

Re: Zig 0.4.0 Released

#20
post #3

Zig's new release has a ton of improvements: new targets (e.g. LLVM 8, WASM, support tiers), C pointers, Vector type, better docs, and my personal favorite: Zig now makes things as static as possible by default. I love seeing all the progress with Zig, V, Muon, and Rust. All these languages are potentially-better systems languages than C/C++, with better safety, better definitions, and better semantics. Zig has an ex…

Honestly, I don't see it happening. Zig and rust and jai and d all feast on c's remains, but the result can only be fragmentation. And then you lose one of the big draws of c: ubiquity. Zig has two compilers. Rust has one (serious) compiler. Jai has 1, d has either 1.5 or 3.5 (depending on how you count). And although all those languages want to replace c as the language-that-you-use-for-everything, and they might each be better than c as a language-that-you-use-for-everything, but for a given use a 'lighter' language like python is frequently even better. And it gets to the point where the only languages that allow you to program anything (lisp and perl6, really) are garbage collected and have heavy runtimes, so they won't be taking over games or the os.

C might die, but there's no replacing it. Sorry.

Post reply on HN