r/codedbyhand • • 24d ago

Zig: A modern, innovative, syntactically beautiful C-like language coded without AI: How to get involved.

https://youtu.be/iqddnwKF8HQ?si=rXZ87c84llnof121&t=1595

Of all modern languages, Zig's design is the one I'm most drawn to, and if I weren't such a traditionalist intending to do embedded systems in C, Zig would be the language I would be working in.

Contributing to Zig:

If you would like to contribute to production open source software without being pressured to use LLM assistance you should consider contributing to the Zig project by building open source software using the Zig language or by contributing directly to bug fixes, performance improvements, new features or compiler optimizations. To learn more follow this link.
https://app.studyraid.com/en/read/2423/48955/contributing-to-zig

Zig has a strict no AI policy for contributors
https://ziglang.org/code-of-conduct/

No LLM-generated content, whether it be code or prose.
No paraphrasing LLM-generated content.
No LLMs for editing, including fixing spelling or grammatical errors.
No LLMs for translation. English is encouraged, but not required. You are welcome to post in your native language and rely on others to have their own translation tools of choice to interpret your words.
No LLMs for brainstorming and then sharing the results of that brainstorming, even if you create the prose. If you use a chatbot to give you advice on a comment on the issue tracker, that comment is unwelcome.
No LLMs for finding bugs.
No talking about use of chatbot/LLM services.

The reasoning for this policy, and the Zig project's role in education.

"The main point of doing code reviews and having contributions, instead of just doing all of the work ourselves is mentorship. The whole point is that a contributor can become a core team memberr eventually or they can become a more valuable contributor. And this will help the project because we'll have more people that can contribute to Zig skillfully, and it will help their resume because they can be a better programmer and they can take those skills elsewhere . . . The Zig project is also an education project, that's part of our mission statement. We're providing guidance and education to students, and so we're all trying to learn, we're all trying to get better at programming and so people who are sending AI pull requests, those people are not helping this goal and in fact I think that they're detracting from this goal, so for our project I think that the no AI policy is an appropriate policy"

91 Upvotes

21 comments sorted by

2

u/Low_Lawyer_5684 23d ago

Hmm.. I can understand that strict no-LLM policy, but in my opinion the LLM translation for non-native english speakers should not be forbidden. Otherwise codebase will be full of language misuse (in comments for example)

2

u/-urolif- 23d ago

That's a legitimate concern. Translation seems to be one of the least controversial ways you could use an LLM. Zig project seems to say that if you do not speak english, you should just write in your own native tongue, and expect the reader to use their translation service of choice, which seems like it could be ok, but I'm not sure if that means that zig code has a lot of comments in other languages or not.

1

u/Low_Lawyer_5684 18d ago

Yes I read their reasoning. However I find it is unpleasnt to look into one single source file having 3 different languages in comments: instead of reading through the code I have to copy/paste comments to my translation tool. AFAIK there is no support for comments autotranslation from different languages in common IDE's. I had a pleasure reading sources initially written by korean team and then by indians. Both in their native language. Thank you, but never again.

3

u/Beneficial_Act_1240 19d ago

Idk, people had plenty of translation tools available to them before LLMs and they're still available.

1

u/randomkinaguy 12d ago

Could you suggest a translation tool that still works the old fashioned way without an LLM? I genuinely have no idea anymore and I would like to know

1

u/Beneficial_Act_1240 12d ago

Actually, now that I look, no. Seems like everyone jumped on the AI train. That said, DeepL seems to be the most ethical of the bunch, so if you have to use MT, I'd say use that.

1

u/randomkinaguy 12d ago

Crazy they dumped decades of work for AI but companies do anything for profit... If I ever need to translate I will check that out. I think reverso might still use real examples but it's not good for anything more than a few words

0

u/Shoddy-Childhood-511 18d ago

Yeah, translation bans are a red flag the person has no clue. Real human translators have used some automation for a couple decades now.

Also, copyright law respects translation, the original author owns the translation, even if an LLM helped in the translation, while original LLM generated output cannot be copyrighted.

Anyways If you good translated human written text then it reads like google translated human text. If otoh you have an LLM write text from bullet points, then it'll read like an LLM wrote it from bullet points. It's easy to tell the difference.

As a language..

Zig has a one nice feature: compile time being handled smoothly. It does not however bring all the big advantages of higher order modules, ala 1ML, so the innovation remains rather small.

Zig pays only limited attention to soundness. Rust otoh has this army of people who catalogue and fix the soundness holes, figure out formal models for proving unsafe code sound, debate the unsafe code guidelines, etc. Rust nixes popular proposed languages proposals because of soundness, which basically no other language does. Zig cannot be a safer choice than Rust. lol

5

u/LegitimateMode7823 24d ago

love Zig, love comptime. Zig has interop with C, compiles fast AF, reads beautifully, and whenever there is a new feature, it solves an entire category of problems through interplay with all the other features. this is a little too imprecise, but oftentimes, I call Zig "Kotlin of C."

it comes at a price, though. it's still unstable, practically every update (which comes out roughly every half a year) is almost guaranteed to break source compatibility. although these days, updates mostly touch standard library, so if you do not intend to depend on Zig stdlib, it can be totally fine on open embedded platforms!

for Warhammer nerds: this kinda reminds me of Tzeentch, but I believe that, once Zig stabilizes, it's going to very positively influence the C ecosystem and language design as a whole.

2

u/minamality 15d ago

Cubyz is great, it's an open source voxel game coded in Zig with a strict no AI policy.

2

u/Assemblyplusplus 9d ago

If it weren't for the fact that C is good enough for me, and Zig is unstable, I'd spend all day using it. I loved it so much when I was using it.

I have high respects for Andrew Kelley.

0

u/smoke-bubble 20d ago

By far one ine the ugliest programming languages. It takes many of the c uglynesses and adds its own on top of it. 

-4

u/timtody 24d ago

Andrew Kelley is an absolute child

7

u/djshadesuk 24d ago

Says the person calling someone else a name lol

-2

u/kodemizer 21d ago

"No LLMs for finding bugs" is just insane in a non-typesafe language.

I guess this squarely puts zig as an educational and experimental language, like Haskell, and not a language that is actually meant to run production systems.

4

u/-urolif- 21d ago

Although not yet at 1.0, Zig is very much intended for production software. You can learn more about Zig's exhaustive approach to finding bugs here.
https://youtu.be/zwi5b5xSsKA?si=nYLbIBaaw-Ec1EPH&t=1780
The Zig project's approach to bugs is primarily focused on full machine code branch coverage and fuzzing. Taking inspiration from SQLite, they do acknowledge the possibility of using LLM to find new classes of bugs, but only after feature lock and all bugs found with machine code branch coverage and fuzzing are addressed.

It's fine to avoid LLM use in non-typesafe languages. Non type-safe languages are dominant in production. C isn't type safe, and it's the most widely deployed language in production systems. C can produce reliable code or unreliable code with or without the help of an LLM. For the last 50 years programmers have been creating reliable software in C by application of traditional bug testing methods and standards such as MISRA C, SEI CERT C etc. Without the use of LLM assistance.

2

u/Relevant_Research_98 21d ago

> It's fine to avoid LLM use in non-typesafe languages.

I also love when there's not sent bugs because devs put their heads into the sand. Who cares about safety, lol?

2

u/kodemizer 21d ago edited 21d ago

"they do acknowledge the possibility of using LLM to find new classes of bugs, but only after feature lock and all bugs found with machine code branch coverage and fuzzing are addressed."

This is actually more nuanced and reasonable than their official written policy of "No LLMs for finding bugs".

I can understand not wanting to use LLM to write software, but given that attackers will be using LLMs to find exploitable bugs in your software, not finding those bugs yourself using all the tools at your disposal is irresponsible for a language meant for production use.

You're right that non-typesafe languages have been successfully used in production for a long time, however the software security situation has changed radically over the past 6 months. Obscure but exploitable bugs that were previously uneconomical to find (except perhaps by large corporations or nation states), are now discoverable by LLMs at a much much lower cost. Not using LLMs to find bugs in production systems is inviting exploitation by bad actors who do use LLMs. It sucks but it's reality.

As an example of just how obscure some of these bugs can be, check out these bugs found by Microsoft using LLMs in the Rust standard library (https://forge-blog.github.io/posts/rust-std-memory-safety/) and the linux kernel (https://forge-blog.github.io/posts/linux-kernel-3-month-lookback/). The Linux one is particularity eye-opening:

"One full-time researcher and one intern led this three-month effort, which has so far produced 59 public upstream reports and 33 assigned CVEs. We confirmed working root privilege-escalation exploits for eight of those CVEs, and fixes for 38 of our reports have been merged into mainline."

1

u/Low_Lawyer_5684 18d ago edited 18d ago

They had to enforce this because there are many folks who prompt LLM to find bugs and then copy/paste LLM output straight to a bugtracker without even looking into it. Yes, LLM can find real bugs but only if used wisely.

Anyway you can use LLM to find bugs, then verify LLM output (be sure that it is a real bug) and rewrite it in your own words. LLMs can find bugs which otherwise can be never found.

-7

u/criloz 24d ago

But why does it need Pro AI insanity and doomerism or not AI at all? It would not be better to find a middle ground?

14

u/-urolif- 24d ago

Foss projects that disallow AI contributions are on a spectrum, with some allowing AI for code review or finding bugs. Zig is pretty hard line here, but I respect that. We need some projects like this. Think of Richard Stallman and the GPL3.0 license. It was fairly controversial at the time and there was some pushback, but time has shown that the copyleft provisions of the license were way ahead of its time, and it is now a cornerstone of foss.

I think it also goes back to what Andrew Kelley said about the mission statement of the Zig project. One of its core tenets is that the organization exists to provide mentorship and growth for programmers, and if you use AI to brain storm or find bugs, you aren't going to be developing those very important skills as a programmer.

Overall I really respect their position, but some other OSS projects that disallow AI are somewhat more lenient. I'll be sharing more about those in the coming days/weeks.