8 ms·
Zig 0.5.0 Release Notes
- lhorie 7y agoZig looks like a really interesting language. I've been keeping my eye on it, waiting excitedly for the 1.x milestone. Out of curiosity, what's the state of the world regarding Zig's stdlib? While the base language docs seem like they're in a pretty good state, the stdlib is still largely undocumented. Is this because it's unstable? Or is the lack of docs there due to lack of time/resources? Would love to get some clarification. Thanks!
- rhodysurf 7y agoThe stdlib documentation is definitely the biggest sore spot of zig for me. It took me a little while to feel comfortable enough digging through the code to start finding what I could do with the stdlib. It slows me down programming using the language significantly.
- AndyKelley 7y agohttps://github.com/ziglang/zig/wiki/FAQ#where-is-the-documentation-for-the-zig-standard-library https://github.com/ziglang/zig/wiki/FAQ#where-is-the-documen...
- lhorie 7y agoYeah, I always check that. The part that says "There is no stdlib documentation yet, but it is planned for the next release" links to a 2015 github issue. That's why I was wondering if it's still a priority or if there were still high level concerns about stability/curation/etc preventing docs from being written.
- AndyKelley 7y agoIt's an unwillingness to implement documentation generation twice. Why do it in the c++ compiler when the goal is to become self-hosted? I think there's a good answer to this which is, "because people really, really need documentation." So I am kicking around ideas of how this can be done without too much duplicate effort.
- lhorie 7y agoI see. Do you think there would be value in having someone just manually writing some interim docs (perhaps as a wiki) until the time when it can be properly generated? This may seem like a weird place to draw experience from, but in my early days of programming, I've found the PHP docs extremely helpful largely thanks to community comments sections giving examples of how to do various things. Just some food for thought.
- AndyKelley 7y agoI think that would be problematic because the standard library is still very unstable. You can see from the release notes just how much changed from 0.4.0. A wiki page would be outdated right away. One of the tenets of my development process with Zig is "avoid local maximums". A wiki for std lib documentation is not the long term solution to the problem, and so I won't be investing any time into it. All my time is invested in the long term solution.
- jeremyjh 7y agoCouldn’t you say this about every single feature implemented in the C++ compiler?
- andrewnc 7y agoIt's an exciting week for programming languages. First Nim, then Zig. Keep up the great work!
- azhenley 7y agoAnd Crystal! https://crystal-lang.org/2019/09/23/crystal-0.31.0-released.html https://crystal-lang.org/2019/09/23/crystal-0.31.0-released....
- rvz 7y agoSorry! But Crystal was last week's news! This week is Zig's turn on HN :)
- azhenley 7y agoTo be fair, Crystal's release was the same day as Nim! But yes, now it is Zig's time! I'm happy for all of them.
- petre 7y agoI wonder why scrolling is broken once the page fully loads.
- yellowapple 7y agoSeems to be fine on Firefox (both with the mousewheel and arrow keys).
- loudmax 7y agoDoes anyone here have a good understanding of the relative merits of Zig, Crystal, and Nim? Especially compared to higher profile languages like Rust and Go? All of these languages seem to be statically compiled, and they all seem to promise both performance and safety. Rust and Go are discussed all the time on HN, so I expect most of us here have a reasonable notion of their relative benefits, for example, performance compared to ease of learning. What about these lesser discussed languages Zig, Nim, and Crystal? Are their runtime performances comparable to one another? Are they equally safe to program in? What are their relative strengths? Or does it just come down to syntax preference? I think there's value in having a lot of choices to program in, so I'm not asking which language is "best" any absolute sense. We're better off for having all of these languages coexisting. I'm just asking if anyone with experience in the three of them has any insight or impressions of their relative merits.
- codetrotter 7y agoOne thing that immediately stood out to me was the section titled “UEFI support” [1]. And there are demo projects and examples too. Neat! [1]: https://ziglang.org/download/0.5.0/release-notes.html#toc-UEFI-Support https://ziglang.org/download/0.5.0/release-notes.html#toc-UE...
- rvz 7y agoZig + UEFI = Comic Neue in the BIOS. [0] https://twitter.com/andy_kelley/status/1176561072398098432 https://twitter.com/andy_kelley/status/1176561072398098432 Perhaps I could see some toy ransomware bootkit demanding the user to pay up or face using your computer with comic neue or comic sans as the default unchangeable font.
- vanderZwan 7y ago> Comic Neue For the uninitiated: http://www.comicneue.com/ http://www.comicneue.com/ As far as Comic Sans-like fonts go it's quite nice
- yellowapple 7y agoIt's currently my main UI font: https://imgur.com/cTLq6Oo.png https://imgur.com/cTLq6Oo.png Pairs nicely with Fantasque Sans Mono (though if there was a more Comic Sans/Neue-like typeface, I'd set that as my terminal/editor font in a heartbeat).
- svnpenn 7y agoLooks like its still lacking in network support: https://github.com/ziglang/zig/issues/2007 https://github.com/ziglang/zig/issues/2007 I wonder though, does it already have socket support? that could be a stopgap for me. Edit, looks like it doesnt have sockets either: https://github.com/ziglang/zig/issues/1271 https://github.com/ziglang/zig/issues/1271 Edit 2, looks like it does: https://github.com/ziglang/zig/blob/5026db1d/lib/std/net.zig#L219-L247 https://github.com/ziglang/zig/blob/5026db1d/lib/std/net.zig... https://github.com/ziglang/zig/blob/5026db1d/lib/std/os.zig#L1724-L1748 https://github.com/ziglang/zig/blob/5026db1d/lib/std/os.zig#...
- rhodysurf 7y agoYou can use any c libraries networking or socket implementations in zig but I think thats as far as it goes at the moment.
- donpdonp 7y agozig's C-interoperability is second to none and using libcurl works great for networking. example: https://github.com/donpdonp/zootdeck/blob/master/src/net.zig https://github.com/donpdonp/zootdeck/blob/master/src/net.zig
- svnpenn 7y agoCan you though? I cant get cURL to work: https://github.com/ziglang/zig/issues/988 https://github.com/ziglang/zig/issues/988
- johnisgood 7y agoI might be alone with this thought: Zig seemed really appealing in the beginning, but now I dislike it more and more with each release. It does not seem to keep the simplicity of C at all, it has lots of peculiarities, and it is becoming more and more bloated. I would consider it a C++ replacement at this point, not a C replacement due to its increasing complexity. One of Zig's philosophy was simplicity[1], but I do not think it applies now. [1] https://github.com/ziglang/zig/wiki/Why-Zig-When-There-is-Already-CPP,-D,-and-Rust%3F#simplicity https://github.com/ziglang/zig/wiki/Why-Zig-When-There-is-Al...
- rhodysurf 7y agoCan you give examples of the peculiarities? I write cpp all day and zig is a nice change for me because of how simple it is to me
- richardwhiuk 7y ago> Zig both signed and unsigned integers have undefined behavior on overflow, contrasted to only signed integers in C make a feature unwanted in C, worse. nice.
- AnIdiotOnTheNet 7y agodebug and safe modes in zig disallow overflows entirely unless you specifically use the wrapping operator to clearly specify your intent. These checks are removed in speed-optimized builds. In other words, the compiler will enforce that `a + b` does not overflow through all your testing and wherever you explicitly say such checks are required, but turns them into nops for you when you desire speed. You can let the compiler know that you explicitly want wrapping overflow (and not some undefined kind) using the wrapping operator `a +% b`.
- stateoff 7y agoPlease check your facts: https://ziglang.org/documentation/master/#Integer-Overflow https://ziglang.org/documentation/master/#Integer-Overflow
- dev_dull 7y ago> Speaking of performance, Zig is faster than C. These kinds of claims make me so dubious for a language. Also who is trying to switch from C to get an ever-so-slightly performance improvement? That use-case goes to specialized hardware such as FPGAs.
- AnIdiotOnTheNet 7y agoIt's not about the speed being a benefit per-se, but rather not a determent. One of the big reasons people still use C over other languages is that C is perceived to be faster (and indeed usually is).
- trulyrandom 7y agoWhether the claim hold up or not. If you developed a language that's faster than C, would you not advertise that as a feature?
- 0xdead 7y agoI would, first of all, call bullshit on this claim. A language can't be "faster than C". Comparing a good implementation with a bad C implementation is where these claims come from.
- ogoffart 7y ago> A language can't be "faster than C". Why not? For instance, with current hardware, the good use of SIMD is critical. If you can't write vectorized code in (standard) C while you can do it in another Language, that would be a "faster" language. Same for other language features that enable faster code: Compile-time computations, better memory model with different pointer aliasing semantic, ...
- Bootvis 7y agoYou can dispute Zig, but in practice there is FORTRAN that is faster for many math procedures.
- StreamBright 7y agohttps://ziglang.org/documentation/master/#Zen https://ziglang.org/documentation/master/#Zen >> Minimize energy spent on coding style. For me this is sort of important because languages not having standard coding style end up 10000 coding styles. Rust fmt is an excellent example for avoiding that. Does anybody use Zig + fmt? I know they have something. https://github.com/ziglang/zig/issues/1523 https://github.com/ziglang/zig/issues/1523
- steveklabnik 7y agoThere's a section in this notes about it https://ziglang.org/download/0.5.0/release-notes.html#zig-fmt https://ziglang.org/download/0.5.0/release-notes.html#zig-fm... The end even has a link to a web-based version of it.
- StreamBright 7y agoThanks, I totally missed it.
- lkey 7y agoThe new async/result location stuff reminds me of the Pin concept that Rust fairly recently adopted. It seems like a pretty huge step forward for the language. Especially since it's casually mentioned that it also solved "safe recursion". I'm curious about the tools zig offers around doing asyc work while guaranteeing certain invariants, and how the @Frame builtins work with that, but I'm guessing that's going to be elaborated on in a future post.
- deleted 7y ago[deleted]
- sysashi 7y agoThe author also livestreams (I believe on twitch) and publish VODs on youtube, showcasing new features, updates and whatnot! I'm quite enjoying watching progress updates, relevant examples and Q&A :)
- jzelinskie 7y agoThe streams are on Twitch: https://www.twitch.tv/andrewrok https://www.twitch.tv/andrewrok
- crudbug 7y agoLooks promising. Can we have a consistent function notation fn name(a: int, b: int) -> void {} This also helps with clean functional type arguments. swift and rust support this. A single consistent notation will be helpful for new polyglots.
- FpUser 7y agoAt the very first glance: what is wrong with function xxx() instead of fn xxx() what are we trying to save here? Also would be nice to do import instead of @import. More readable I think. Afraid to dig deeper as I do not have time to play with the languages that I can not yet use in production.
- yellowapple 7y agoThe @ indicates that the function's built into the compiler itself. Yeah, it looks ugly, but it's nice to be able to visually identify "okay, yeah, this didn't come from any of my imports", and also (I'd assume) avoids cases where one might inadvertently shadow them with their own function definitions. Re: fn v. function (v. fun v. def v. defun v. defn v. define v. proc v. sub v. label v. the cornucopia of other options here): I don't think it's all that big of a deal. fn does happen to be short, which means more actually-useful information can fit into the same line, so I guess that's nice. The choice of keyword for function definition feels like a really weird criticism.
- flukus 7y agoZig, Crystal, Nim, Rust, Go. It seems like the industry is responding to the end of moores law and is refocusing on performance. Contrast this with 90's languages like python, ruby, java and c# where computers were expected to get exponentially faster and they focused on developer ergonomics instead. Can anyone familiar with zig tell me how well it works with more macro heavy libraries? Something like GTK (https://developer.gnome.org/gtk-tutorial/stable/c450.html https://developer.gnome.org/gtk-tutorial/stable/c450.html) or something with generics.
- muktabh 7y agoThe windows build isn't working for me. Still stuck on 0.4 .