Live data from Hacker News

Zig 0.11

ziglang.org

151–160 of 193 posts

Re: Zig 0.11

#151

Earlier quoted context omitted.

And this attitude is why it's a serious issue in our industry. You clearly don't take security seriously, to the point that it's a laughing matter for you.

If you can't see why jailing people for writing JS is a comically absurd concept…

Why is JS even relevant to this discussion?

Re: Zig 0.11

#152

I wanted to try learning Zig, but found the resources to be incomplete and lacking in examples. Rust (or Go) in comparison has a plethora of online resources with great examples. I realize Zig is just 0.11, but wondering what resources people relied on to pick it up?

The main available resources are listed here

https://ziglang.org/learn/

Re: Zig 0.11

#153
post #142

Earlier quoted context omitted.

The point was typical, typical Rust code is using Vec , typical Zig code is using arenas. Typical Rust code is using smart pointers, typical Zig/C code prefers plain, copyable structs. It is 100% possible to use such style in Rust/C++ (and then the performance will be same or maybe even in favor of rust, it might be the case) but people usually do not do that.

It shouldn't be hard to make Zig go to top place then, which is great opportunity to shine, given that they are still missing Zig entries, https://benchmarksgame-team.pages.debian.net/benchmarksgame/... https://www.techempower.com/benchmarks/

Zig can and does win plenty of those benchmarks, but ultimately it boils down to who is it that gets nerdsniped into working on a specific challenge.

For example in this case Zig won big time over what C/C++/Rust people submitted: https://youtu.be/pSvSXBorw4A?t=1075

Zig is in the same ballpark as the ones mentioned above, so flohofwoe is right. But nevertheless I do think that cztomsik's point also still stands: how hard it is to make something fast will end up impacting the performance characteristics of the average program and library out there, and Zig does make it easier to write performant code than some other languages.

Which is basically what happened here: https://zackoverflow.dev/writing/unsafe-rust-vs-zig/

In truth the same applies to correctness, which is also a point that the blog post above touches upon.

Re: Zig 0.11

#154

Earlier quoted context omitted.

I’ve been using the language reference [0] and also just browsing the standard library source code [1] for examples. [0]: https://ziglang.org/documentation/0.11.0/ [1]: https://github.com/ziglang/zig/tree/master/lib/std

That's important: don't be afraid to look into the stdlib source code when questions arise. It's easy to read and stuff is easy to find, and it's also a great teacher.

Since go, this has been a really great way for me to judge a langage: how readable is the stdlib ?

If it's layer upon layer of unscrutable abstractions, then you know there's a high chance your codebase will end up looking the same after a few years.

Re: Zig 0.11

#155

Wow, those are really nice release notes.

I wrote a good chunk of these notes and can tell you that these are probably the least detailed/useful we've ever done, because they were only about 40% completed when release day came, so we spent a few hours doing quick & sloppy improvements :P you can hopefully expect them to improve a bit over the next few days

(although I think we still managed to write up all of the most important bits)

Re: Zig 0.11

#156
post #155

Wow, those are really nice release notes.

I wrote a good chunk of these notes and can tell you that these are probably the least detailed/useful we've ever done, because they were only about 40% completed when release day came, so we spent a few hours doing quick & sloppy improvements :P you can hopefully expect them to improve a bit over the next few days (although I think we still managed to write up all of the most important bits)

interesting. Maybe those are the first I follow with interest and it's just the general quality of presentation / fitting level of detail / "tone". Maybe I'm just complimenting your template, but feel free to feel addressed!

Re: Zig 0.11

#157
post #5

What are the use cases for zig? The website says general purpose and tool chain but people who have used it, what it excels at?

I've been thoroughly enjoying implementing a compiler and bytecode interpreter in Zig for a little scripting language I've been designing.

Re: Zig 0.11

#158

Zig is not memory safe and therefore at risk, just like C/C++, of future government legislation that outlaws the use of memory unsafe languages for some or all projects. The risk of such legislation is not insignificant: https://www.itpro.com/development/programming-languages/3694... Personally I do not see the point of building an entirely new language and ecosystem that does not fully address this issue.

IF a Gov subcontracts a company to design + impl a system, they as Customer (if you like) have the right to request specifics; maintenance & integration with the wider ecosystem is a massive concern in this case. That's not "legislation" though.

Re: Zig 0.11

#159
post #80
post #24

Earlier quoted context omitted.

“Linked lists are hard” is not “none of the common knowledge around traditional data-structures and algorithms work”.

I retort that almost all of the concurrent data structures are obnoxious to represent in Rust. A lock-free ConcurrentHashMap, for example, is by no means a straightforward data structure in a non-GC language. Even if you somehow dodge Rust's pedantry, you still have to figure out who owns what, who pays for what and when they pay for it--and there are multiple valid choices! Non-GC allocation/deallocation in concurre…

This is partially why allocation is left to the caller (concurrent data structures are often intrusive), have single consumers (made lock free using separate synchronization) or only have lockless guarantees not obstruction freedom.

I think the obnoxious part in Rust is doing intrusive and shared mutability parts of data structures. Having to go between NonNulls, Options, Pin, and Cell/UnsafeCell is not a pleasant experience.

Re: Zig 0.11

#160

Earlier quoted context omitted.

I thought Go tried to be better C

Why should there only be one "better C"? Go has a very different philosophy than Zig, but both can be considered a "better C".

Possibly the thing that makes C be C is that there is only one C. It is the single lingua franca of "one notch up from assembly". I would argue any language that wants to be a better C has to accept the challenge of being available on any platform, existing or future, any architecture, suitable for any bare metal use case, and it has to want to be the single obvious go-to choice. That's what it means to step into the ring of "better C" candidates. A lot of languages might offer pointers, manual memory allocation, no runtime, etc. That's cool and that gets you close to the space. But if you want to be a better C, then the bar is much higher: ubiquity.
Post reply on HN