TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Zig Is Self-Hosted Now, What's Next?

303 pointsby kristoff_itover 2 years ago

19 comments

eatonphilover 2 years ago
I&#x27;ve been learning Zig by porting my toy SQL database in Go to Zig (both projects are on Github, you can go find them if you&#x27;d like). This is my first time trying to seriously use a non-GC language for a project, so there&#x27;s a big learning curve unrelated to Zig in particular. However, it&#x27;s much easier than trying to learn C (which I&#x27;ve tried a few times). The standard library is incredibly feature rich compared to C (although I&#x27;ve heard whispers that eventually they plan to reduce the size of the standard library, which I&#x27;d personally find sad). defer is awesome. comptime too.<p>I haven&#x27;t noticed miscompilation yet but I have noticed occasional unclear error messages such as it pointing at the wrong line. I&#x27;ve meant to make a note of these but since I&#x27;m just focused on learning I haven&#x27;t done a great job of writing down these minor bugs.<p>I don&#x27;t think the breaking changes (which haven&#x27;t seemed that big) are a huge deal for most folks curious about PL in general. And I think the potential for being a better C is just so great that it&#x27;s worth continuing to try out Zig and follow it&#x27;s development. In particular I think it would make a lot of sense as a teaching language for the college courses that would otherwise use C. And I think it would be a pretty fancy compilation target for language implementations like Chicken Scheme that otherwise target C. (I&#x27;m sure it would be great in other situations too but these two are ones I can relate to most.)<p>But I&#x27;m still early on in my exploration of Zig. (Disclaimer: the company I work for uses Zig and sponsors ZSF.)
评论 #33334963 未加载
评论 #33340143 未加载
评论 #33336469 未加载
j-pbover 2 years ago
Correctness please. Zig is a way too simple language to justify all the really easy to hit bugs.<p>I&#x27;d give everything for a zig compiler that&#x27;s 10 times as slow but actually compiles my code.<p>Also testing infrastructure. Zig really needs fuzzing and property testing tooling build-in. Hitting stage 2 with arbitrary autogenerated zig code and IR, would have really helped detect regressions for example.
评论 #33333918 未加载
评论 #33333787 未加载
评论 #33333154 未加载
评论 #33333111 未加载
评论 #33333629 未加载
skohanover 2 years ago
I watched the linked talk by Andrew Kelly - super interesting stuff. I&#x27;ve played a bit with data oriented design in the context of implementing an ECS, but some of the topics he discusses take it to another level entirely, and it&#x27;s very cool to see it applied, with measurable results, in a large serious project like a compiler.<p>I have a lot of admiration for Zig, as I think it takes a very interesting approach to being a &quot;better C&quot;, and the no-nonsense approach, ruthless simplicity, and thin abstraction over the hardware fall very much in line with my values as a programmer.<p>As a product manager, a few thoughts ran through my head when when I was watching this: with where Zig is as a language, is this kind of focus on extreme memory optimization actually the best use of his time?<p>There&#x27;s an argument that it might be: maybe this is an exercise in dogfooding Zig as the kind of language which is suitable for data oriented design. Or it could be Kelly has fallen victim to the temptation many of us do, in following the most fascinating path rather than the one that&#x27;s creating the most long lasting value.<p>Either way I guess that&#x27;s a luxury he has the right to indulge as an independently funded auteur PL designer.
评论 #33335178 未加载
评论 #33335401 未加载
Kukumberover 2 years ago
Congrats, fast compile speed is a requirement nowadays, any language that is slow to compile puts you at a risk of not being able to fix important prod issues quick enough, hence why i use Go for my backend, i can&#x27;t imagine using anything else<p>Tests, deployment, up to restarting the service in prod, the language should empower me to not loose time<p>I&#x27;m not talking about memory bugs, i&#x27;m talking about typo issues, API issues, comment&#x2F;uncomment, renaming, missing a semicolon (that one should go imo), refactoring etc, a fast compiler allows me to be more productive<p>Having to recompile due to typos is the main contributor of wasting my time, if it takes 10+ seconds, then the language sucks, it should be instant up to 1 second<p>Glad that you understand that and you made sure you built the foundation that enables it, that&#x27;s game changer
评论 #33337313 未加载
habermanover 2 years ago
&gt; We are also working on a special backend, one that produces C source code. Progress on the C backend has recently shot forward (87% and counting) thanks to an amazing recent contribution.<p>I love this. It&#x27;s great story for people who want to develop in a newer language while having seamless interoperability into older toolchains and ecosystems (eg. TS&#x2F;JS). If it reaches production quality, that will be a large selling point for Zig IMHO.
rychcoover 2 years ago
I always enjoy reading about Zig advancements. I haven&#x27;t developed anything substantial in Zig yet, but I&#x27;m very optimistic about the future of the language.<p>If you&#x27;re curious to see a large Zig codebase, two significant projects are Bun [1] and TigerBeetle [2].<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;oven-sh&#x2F;bun" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;oven-sh&#x2F;bun</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;tigerbeetledb&#x2F;tigerbeetle" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tigerbeetledb&#x2F;tigerbeetle</a>
评论 #33340732 未加载
DrBazzaover 2 years ago
Nice achievement.<p>Curious about this though:<p>&gt; building the compiler itself used to require 9.6GB of RAM, while now it takes 2.8GB.<p>Why is the RAM usage so high? It was only a few years back and we were building C++ compilers on machines with barely 16MB.
评论 #33333072 未加载
评论 #33333068 未加载
评论 #33332977 未加载
评论 #33332810 未加载
评论 #33332934 未加载
评论 #33332838 未加载
评论 #33333274 未加载
评论 #33339362 未加载
DrNosferatuover 2 years ago
Congrats Zig Team!<p>Allow me to comment from my professional perspective:<p>I have been working deep inside the spaghetti-stuffed soft underbelly of the computational infrastructures of multitudes of international “Big Science” projects and consortia. Zig seems like a very, very good fit. Are there any static code analysis tools that support it? Such functionality would be a killer app…<p>Wild idea: what about building one inside Zig? (or repurpose some other external tool to eventually integrate &#x2F; be a “companion” tool and perform static analysis seamlessly)<p>PS: Of course with C support from the get go - maybe additionally other languages.
评论 #33336953 未加载
1vuio0pswjnm7over 2 years ago
When Golang switched to a self-hosted compiler, it lost compilation speed. When Zig switched to a self-hosted compiler, it gained compilation speed.
评论 #33339860 未加载
评论 #33340118 未加载
_7bxaover 2 years ago
To all people complaining about bugs: 1. It&#x27;s easy to find flaws in hard, ambitious projects. All ambitious projects start out as WIPs. 2. It is much harder to do an ambitious project.<p>Try to be in the 2nd group.
评论 #33351100 未加载
评论 #33336640 未加载
sitkackover 2 years ago
I hope Zig continues to ship clang, because Zig is the easiest way to install clang.
评论 #33335280 未加载
评论 #33345517 未加载
2pEXgD0fZ5cFover 2 years ago
&gt; The package manager will not assume the presence of a central package index. We don’t plan to create an official package index.<p>This is great to hear!
zamalekover 2 years ago
&gt; What’s interesting about this [C] backend is that it will play a role in our plan to replace the old bootstrap compiler implementation<p>That&#x27;s super neat. I&#x27;m guessing the plan is to generate stage1 during CI or something with this backend?
david2ndaccountover 2 years ago
I wonder if Zig is getting too much hype at the moment considering its immaturity (and so many easy to hit bugs as noted by other commenters). Is it getting hype before it&#x27;s ready? Will it be able to recover from that?
评论 #33334135 未加载
评论 #33333992 未加载
评论 #33342907 未加载
richardanayaover 2 years ago
It would be nice to have a public Zig webassembly compiler that anyone could import and use.
raouljover 2 years ago
What is the reason to not have a central package index? I find that having one speeds up my development significantly. Is there more reason than decentralization?
评论 #33337007 未加载
评论 #33334270 未加载
butterisgoodover 2 years ago
Port to 9front!
jokoonover 2 years ago
Write a &quot;Zig in Y minutes&quot;, to me a language doesn&#x27;t exist if it&#x27;s not there.<p>Add vector math types&#x2F;functions&#x2F;operators, those should be standard, in my view.
评论 #33334922 未加载
评论 #33334933 未加载
thefauxover 2 years ago
Zig seems to have captured a lot of attention in the new language design space, and I personally find this unfortunate. Frankly, I find it irresponsible that the team has marketed a pre 1.0 language so heavily. By constantly evolving the language and making frequent breaking changes, they are quite literally wasting people&#x27;s time. They also have been very hostile to people who have raised fair points about the misleading claims that they have made.<p>From my perspective, the entire premise of the language is flawed. The main project goal seems to be to become a replacement for c. This means that in some sense the project is implicitly defined by c and doesn&#x27;t really stand on its own conceptually. This could be ok if it actually fixed some of the worst problems with c, but most of what it offers appears to be relatively superficial syntactic improvements (which could easily be implemented by a simple transpiler to c). While I am sure that the language designers see things differently, it appears that Zig just lets c programmers keep writing c with some additional compiler checks. This is probably an improvement on c (at least in some respects), but it seems largely incremental. Also because they prematurely evangelized the language, they are likely to be weighed down by the additional complexity that seeped in from trying to support so many different use cases before they had really figured out what the language is.<p>That it took two years to write the self hosting compiler speaks to the fact that this language is already quite complex. My guess is that this complexity is always going to pose problems. Downstream users are always going to be finding obscure edge cases that don&#x27;t work because the language supports so many different things that actually testing everything is going to be extremely difficult.<p>Having said all that, if you love Zig, that&#x27;s great. I don&#x27;t doubt that it offers some real quality of life improvements for you. I just personally believe that this project is an evolutionary dead end and that it is very unlikely to have significant mindshare&#x2F;deployment in say, 10-20 years.
评论 #33334697 未加载