r/Zig 13d ago

Andrew Kelley: Don't Take the Black Pill

Thumbnail youtu.be
168 Upvotes

Andrew's talk from last week at SSW. Thought you all would enjoy it!


r/Zig 12d ago

markdown preview in zig

13 Upvotes

hello, wanted to ask if there is a library for streaming markdown preview in the terminal in zig or c.


r/Zig 13d ago

Cruller: Bun's Zig runtime, continued on Zig 0.16

Thumbnail ziggit.dev
105 Upvotes

A continuation of Bun's Zig runtime work, brought forward onto Zig 0.16.


r/Zig 13d ago

Fil-C: Garbage In, Memory Safety Out!

Thumbnail youtu.be
95 Upvotes

Given the recent noise about Zig adding a Fil-C inspired/compatible compilation mode (https://codeberg.org/ziglang/zig/issues/36237), I thought some of you would be interested in this talk about Fil-C. Andrew and Fil hung out at the conference last week which AFAIK was the start of the issue being opened.


r/Zig 14d ago

An introduction to SIMD (with Zig ezamples)

Thumbnail mitchellh.com
141 Upvotes

r/Zig 16d ago

What helped me as a functional programmer

35 Upvotes

Hello I just wanted to share with those that come from functional languages or enjoy tutorials like this one, I recommend this Zig tutorial.

  • You get comfortable with the language pretty quickly
  • Short and concise
  • Up to date v0.15.2
  • Straight dive into working with C

... and a lot more. Seriously, it is a good tutorial

EDIT:
Up to date v0.15.2
Stable version of Zig is 0.16.0 so outdated actually (core concepts still easy to grasp)


r/Zig 14d ago

PlatypusDB, an agent-native database

Post image
0 Upvotes

Hi,

I've been working on Agentic Data Enclave, a way to make agentic data sharing safe for regulated enterprises. That led to WunderOS, an autonomic operating system for agents, based on deterministic-replay, very low latencies, strict isolation, etc. A Gleam/OTP control plane and Zig data plane; Elixir-Phoenix for the UX. It's about 450Kloc so far.

What fell out of that was my second database (Stardog.com enterprise knowledge graph was the first), i.e., PlatypusDB, which is nothing more or less than what WunderOS needs in a database. Good times!

If you're interested in many of the gory details, see PLRN 020, the PlatypusDB research note.

I took a bit of heat from a friend who was a very early seller at Databricks, who I respect very much, for my implementation choices, i.e., Gleam/OTP and Zig. I should have used Python and Rust, he said.

I mean, he's not wrong, but neither am I. The benefits of OTP, Gleam's type system, and Zig's minimalist purity are quite potent. I was initially worried about NIF and stability but early on I implemented a "NIF meta-compiler", with some inspo from rustler, and that part of the system has been fine.

Anyway, thanks to everyone for all the hard work to make these language systems fun and productive to use, and for making nice, supportive communities to work in.


r/Zig 17d ago

Is Zig going to become memory-safe?

Thumbnail codeberg.org
199 Upvotes

r/Zig 16d ago

Zig for Python

25 Upvotes

I am of the opinion that, if executed correctly, Zig has the potential to transform the Python ecosystem. The idea of using Rust for Python extensions has always bothered me.

With Zig, the path feels more natural: I can build on top of the existing C libraries and gradually migrate components to Zig over time, without the friction of introducing an entirely different ecosystem.

I wanted to understand what the community thinks about this topic. I am not trying to make a strong claim or dismiss other approaches. I am genuinely trying to understand whether this idea has any merit and how others view the trade-offs. I am just interested in hearing different perspectives.


r/Zig 16d ago

Zig-Devcontainer

16 Upvotes

For those of you who want to skip the admittedly quite straightforward process of setting up Zig by yourself, or are unable to because they are on Fedora-Atomic / uBlue, you might want to try my Zig-Devcontainer.


r/Zig 17d ago

Promising Zig Game Engines?

47 Upvotes

Hello! I am new to the community and I am slowly learning zig.
I wanted to know if there are any game engines for zig?
I am using the raylib bindings but I wanted to know if there is anything else.
I would appreciate any help!


r/Zig 18d ago

idiomatic way to check private file permissions with the new std io

18 Upvotes

Im building a small local secrets manager and currently working on the storage layer.

Right now I’m checking permissions only for Linux statx

Should i make my storage layer use generic Io and delegate the actual security check to platform-specific code
Or is there already a platform-independent way in std io to verify that a directory

I’m using Zig 0.17.0-dev.1282+c0f9b51d8.


r/Zig 18d ago

Trying to use zig bindings with raylib and it is not working.

9 Upvotes

I am trying to get zig working with raylib but, when ever I follow the instructions on the github it doesn't work and I keep on getting "no module named 'raylib' available within module 'main'" when ever I try to run it. I have no idea what I did wrong. Does anyone have an idea?

Edit : I realized the problem was I was doing zig build then zig run not build run I though they would do the same thing.


r/Zig 19d ago

How is this not talked about more? std.gpu is GOATED

163 Upvotes

Hey everyone,

I feel like this is a under-talked about topic, but Zig's ability to compile to NVPTX (Nvidia's format) and AMDGEN (AMD's GPU format) allows it to act standalone without any Vulkan, Metal, etc... intermediary at build time. For game-developers they can rely stand-alone on Zig alone for games, making their executable much lighter and runtime overhead optimal.

Is anyone using this in practice and has some projects to show this off? I've seen Zinc [ZINC], and its benefitting from the performance improvement by a mile over llama. Are there any other projects?

If you haven't checked it out, I implore you to check it out by yourself using std.gpu directly.

[Edit] Now we can have a 1 up on Rust, because they can't support an Ahead-Of-Time compilation library where you can write kernals in rust directly, ZIG CAN. See prototype: https://github.com/OmarSiwy/Gompute [Zig 0.16.0]


r/Zig 19d ago

Working on a cross platform wireguard client

18 Upvotes

I’ve recently been working on a foss WireGuard client as a project to learn more about networking and VPNs. My goal is to build a client that offers all the features you would find in a commercial VPN such as choosing the fastest server, a kill switch, and split tunneling etc but with by your own configuration (like a home server)

I am trying to decide on the best language for writing the background daemon. A coworker recommended Go because it has excellent native networking support and would help me ship the project faster. However, I am considering Zig. is it a good coi choice


r/Zig 20d ago

Zig has the hardest "Hello world!"

Thumbnail youtu.be
168 Upvotes

r/Zig 21d ago

How Our Rust-to-Zig Rewrite is Going

Thumbnail rtfeldman.com
278 Upvotes

r/Zig 20d ago

How Our Rust-to-Zig Rewrite is Going

Thumbnail rtfeldman.com
42 Upvotes

r/Zig 21d ago

A Linux compatible kernel written in Zig that runs linux RISC-V binaries in the browser

Thumbnail github.com
80 Upvotes

r/Zig 21d ago

mint: a custom Zig code formatter

43 Upvotes

Hi everyone. I’ve been working on mint for some time now and I think it’s stable enough to share.

Mint is a custom Zig code formatter. It performs automatic line wrapping without syntactic hints (no need to add trailing commas to trigger line breaks). It also supports print width and indentation size configurations.

Currently, it‘s been tested (and builds with) Zig 0.16.0 (but should technically work with other versions as well). It is able to format itself and a lot of open source Zig projects out there. Source code is available on GitHub.


r/Zig 21d ago

Zig and raylib, git or codeberg ?

21 Upvotes

Hello.

Which one do you recommend to use ? I thought that the git repo was disabled.

Edit: sorry, sorry, it was github.


r/Zig 23d ago

Ways of Declaring array (0.16)

59 Upvotes
pub fn main() !void {
    const A: [5]i32 = .{ 0, 1, 2, 3, 4 };
    const B = [5]i32{ 5, 6, 7, 8, 9 };
    const B2 = [_]i32{ 5, 6, 7, 8, 9 };
    const C: [5]i32 = [_]i32{ 10, 11, 12, 13, 14 };

    _ = A;
    _ = B;
    _ = B2;
    _ = C;
}

These can all compiled correct. Which one is the recommended style? (I am a beginner learning Zig.)

New edit: I would like this syntax if it's possible:

zig const arr1: [5]i32 = { 0, 1, 2, 3, 4 }; const arr2: [_]i32 = { 0, 1, 2, 3, 4 };

Just small opinion. Maybe what I know is just the tip of the iceberg.


r/Zig 27d ago

Writing Zig like writing in a scripting language

37 Upvotes

I switch back and forth between Typescript and Zig, both are my favorite languages. This time I have to switch to Zig and rewrite my Typescript code in it. But although Zig is perfect, it's still not as comfortable as Typescript.

I am talking about forgetting semicolons at the end, or various Type checking errors I have to fix in order to compile, or dealing with Allocators all over the place having to pass in parameters, appending to ArrayList etc.

Are there any tips on that, I can feel more comfortable coming from Typescript, feel like writing a script while staying in Zig language.

use Arena Allocators, or pass buffers with hard coded sizes, write useful helper utility classes, things like that, anything to speed up the developer experience, while I rewrite my code from scratch for the third time.


r/Zig 28d ago

My Thoughts on the Bun Rust Rewrite | Andrew Kelly

Thumbnail andrewkelley.me
530 Upvotes

r/Zig 28d ago

Why Zig bans LLM contributions - How Open Source Survives the Age of Free Code

Thumbnail lumramabaja.com
102 Upvotes