HN user

sobeston

135 karma
Posts0
Comments25
View on HN
No posts found.

You could probably make a good docs site in hugo with enough work, but Docusaurus has pretty much everything I need out of the box (and is less annoying to extend). I think it really is a lot better for documentation.

Small self plug: https://zig.guide is ready for Zig 0.12.

Some notable changes in zig.guide since Zig 0.11 came out:

  - Changed from following master, to following major releases (Zig is more stable now, less work for me. Yay.).

  - Migrated from Hugo to Docusaurus, bringing some large frontend improvements.

  - Moved over from ziglearn.org to zig.guide.

  - Removed 'usage in production is not recommended' from the front page.

  - Support for versioning.

  - Greatly improved testing through build.zig.

  - Opened up for github sponsorships.

  - Added another section for supplementary walkthroughs.
The site still isn't nearly where I want it to be but there's been some big improvements in the last few months.

I believe where this stands is that if someone were to contribute and maintain this, then it could be part of the Zig compiler, however it is not something the Zig team themselves are planning on doing. Maybe give it a shot? I personally find the project interesting and fun but I'm not convinced that it's a good solution.

I actually saw multiple people in the Zig core team (and others) actively working on the Zig compiler in person this weekend! Development may have slowed in the last 2 weeks or so because of the SYCL conference; given the turnout I can assure you that there is no decline in people working with or on Zig long-term. If you look at the commits, issues, or the stage 2 meetings (normally held every thursday in the discord), you would also see that the project isn't on the decline. You're correct that the financial reports of the ZSF aren't up to date - these are updated manually so you can expect some delay.

I'm assuming you're the same person that made multiple new stack overflow accounts recently to ask (and answer, on a different account) this question here: https://stackoverflow.com/questions/74040564/is-the-zig-prog... (since removed by moderators).

My question to you is: Why are you trying to force this false narrative?

Author here, I'm just showing how I did it. It took a few minutes to do it for myself - figured it would be worth the 15 minutes or so it'd take to write it down. Just sharing my process, there's nothing too serious about this post.

I've happened to have written a lot of C, but some areas (like this one) I'm not as confident in. This way of casting, and working with types is very poor syntax in my opinion (I mean below in this thread you have people arguing about the spiral rule and such, it's obviously a common confusion).

Zig's way of expressing types and pointers is far superior, these transformations I made were done quickly and I didn't feel like there was any ambiguity or confusion in anything. Just a series of simple reductions, there are no "tricks" or easy mistakes to make in the code. It feels like a trivial proof.

Obviously I am biased, this was posted to zig.news. I thought it was a neat showcase of translate-c, and how zig does some of these things nicer. I'm not telling everyone that they should do what I did, but this works for me and I'm happy to share.

I think Zig does cross compilation (ignoring for the moment, projects with C dependencies) better because it comes out-of-the-box with the libraries and headers needed to target a lot of systems. In Rust, you typically get additional toolchains via rustup, whereas Zig works on all of the targets with a single install.

This is silly.

If you make code that requires allocation and does not have an allocator passed into it, there is literally nothing stopping you from allocating anyway. Zig does not stop you from, for example, heap allocating without the usage of an allocator (Zig does not know what heap allocation even is). You can directly use the std page_allocator (and others) wherever you want, too.

There are very few good reasons to do this (e.g. spawning a thread requires particular allocation; using an allocator might not be sound depending on the OS).

All you have to do is document that it allocates memory and that's fine; there is no split.

The concept of the heap is in the userspace of the language. This terminology is confusing to someone thinking of usermode/kernelmode - this is instead talking of userspace versus language-space. As in, users implement code to reason about heap memory; the language does not know or care what heap is.

At a language level, zig does not have a "new" or a "malloc" or anything of the sort.

Zig in 30 Minutes 6 years ago

Getting command line arguments is covered here:

https://ziglearn.org/chapter-2/#iterators

I don't think that going further into parsing is in scope. std.log is something that definitely needs to be covered. HTTP, I'm not sure about as it requires a lot of extra machinery outside of the standard library and these things aren't mature yet.

Zig in 30 Minutes 6 years ago

Hi, I am currently writing ziglearn.org which aims to show a lot of detailed examples.

Zig 0.7.0 tagged 6 years ago

For future proofing, I just don't want to exactly support tagged releases as of now. Zig could release breaking changes next week and I would update the guide to fit that; master is followed.

Zig 0.7.0 tagged 6 years ago

https://ziglearn.org/ should be up to date for 0.7.0 already. Do have a peak if you haven't yet learned how to use Zig; the first chapter (most of the language) should be readable in under an hour.

LLVM 11.0 6 years ago

It's been working great on windows for me for the last year or so. When did you last try it?

I have done this as zig makes many breaking changes often, not because new features come out all the time (almost all of the things showcased on the site if not all were around back in 0.6). I do not want to teach people things that are already for the most part outdated. Things move very fast, especially in the standard library.

edit: to clarify I am the maintainer/owner of ziglearn