Live data from Hacker News

Zig 0.4.0 Released

ziglang.org

31–40 of 141 posts

Re: Zig 0.4.0 Released

#31

Edit: Just confused myself, comments are // and multiline literals are \\. Thanks to laszlokorte for catching my mistake! Zig claims very proudly it is about clarity but shortly into reading through the documentation I already found this extremely surprising: "Multiline string literals have no escapes and can span across multiple lines. To start a multiline string literal, use the \\ token. Just like a comment, the s…

Note that Zig has line-independent tokenization. As a text editor of Zig code, you can have correct tokenization by scanning to the previous \n and starting from there.

Re: Zig 0.4.0 Released

#32

> 4. blake hash of file contents Why this algo in particular? Is this a security feature? I suppose wrt "Reflections On Trusting Trust" it may be. But if it didn't need to be secure it could probably be a lot faster (assuming this is a critical path for cache hits).

I didn't put a lot of consideration into the algorithm in particular. I was going to do SHA-256 but somebody told me Blake was faster. I haven't tested the performance of any other algorithms, but that's a completely swappable component. I'm sure the hash function will be swapped with a different one before 1.0.0 is done.

As an example, xxHash [1] would probably get you an easy 5-10x performance improvement over Blake2b. So there are some easy improvements if the cryptographic requirement is not needed.

[1] http://cyan4973.github.io/xxHash/

Re: Zig 0.4.0 Released

#34
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 ea…

Maybe I'm a bit of a rust fanboy and a bit of a skeptic but

Zig and Jai aren't going anywhere. Zig appears to be a largely single contibutor (https://github.com/ziglang/zig/graphs/contributors the creator has As for rust we don't know yet how big of a chunk of marketshare it will take from new c and c++ code.

Not many people still use c code for "everything", most have already switched.

Re: Zig 0.4.0 Released

#35
post #24

Earlier quoted context omitted.

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 ea…

I don't see any single thing replacing C (or C++) but what's interesting here is many of these languages work very well with the C ABI, not just as an FFI concept but with notions of memory and data layout. The interesting side effect might be that we'll see Zig not just work with C code but Zig work with Jai with D with Rust. All of that code can still interface with C or C++ code (in both directions). This lowers t…

On build processes, it's surprising to me that the Rust community hasn't developed its own linker. I suppose LD works fine.

Re: Zig 0.4.0 Released

#36
"Zig is aggressively pursuing its goal of overthrowing C as the de facto language for system programming."

If there's one truth I've learned in my decades of dealing with computers, it's that you can't beat C at being C.

Before now, I'd never heard of Zig in particular, but I can think of several other languages that have tried or are currently trying. A lot of people seem to think they can make something a little better than C, in some ways, and that will be enough. I doubt that even C18 itself, if it were invented from scratch today, would be able to unseat another systems programming language.

Everybody forgot about Worse-is-Better: "Unix and C are the ultimate computer viruses". Any language which isn't more 'viral' than C (in terms of being ported, and attracting users) has no chance. You're starting tiny, and growing less quickly.

Re: Zig 0.4.0 Released

#37

Wow, that easy cross-compilation story is great. Neat ergonomic benefits also, like Zip downloading musl on your behalf to create static binaries.

Note that it's not downloading anything. Zig ships with musl source code and builds it from source for the target.

Re: Zig 0.4.0 Released

#38
There are so many neat design choices in zig that make it a joy to code in it even these days. Can't imagine what we get with 1.0.

Some of my personal highlights:

- clean syntax

- comptime (as explicit and simple as it should be)

- reflection

- minimal/no external dependencies

- single threaded mode (instead of taking cuts at runtime)

- concise and explicit error handling

- build-in build system

- amazing C interop

...

Good sample code can also be found in the standard library, and it has the benefit of being up to date with with language.

Thanks Andy!

Re: Zig 0.4.0 Released

#39
post #36

"Zig is aggressively pursuing its goal of overthrowing C as the de facto language for system programming." If there's one truth I've learned in my decades of dealing with computers, it's that you can't beat C at being C. Before now, I'd never heard of Zig in particular, but I can think of several other languages that have tried or are currently trying. A lot of people seem to think they can make something a little be…

We could, back when using C meant having to enjoy access to an UNIX computer center.

Re: Zig 0.4.0 Released

#40
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 ea…

Just like when it was born, for C to die, UNIX has to die, that's the only reason it will be an herculean task to ever replace it.
Post reply on HN