home.social

#ziglang — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #ziglang, aggregated by home.social.

fetched live
  1. Is there a better way to write this?

        // Read config zon from file.
    const my_config = blk: {
    var alloc_w: std.Io.Writer.Allocating = .init(arena);
    defer alloc_w.deinit();
    var reader = my_config_file.reader(io, &.{});
    _ = try reader.interface.streamRemaining(&alloc_w.writer);
    try alloc_w.writer.writeByte(0);
    const buffered = alloc_w.written();
    const terminated_slice = buffered[0 .. buffered.len - 1 :0];
    var diagnostics: std.zon.parse.Diagnostics = .{ .errors = &.{} };
    const my_config = try std.zon.parse.fromSlice(MyConfig, .{
    .gpa = init.gpa,
    .arena = arena,
    .source = terminated_slice,
    .diagnostics = &diagnostics,
    });
    break :blk my_config;
    };

    #Zig #ZigLang

  2. I made it spin! And I didn't use any math libraries -- I wrote the gosh-danged rotation matrix by hand, for some reason.

    But the next section calls for stb, which I will be gladly figuring out how to use with Zig.

    #Vulkan #Zig #Graphics #ZigLang

  3. ...this code:
    ```
    const ubo_ptr = std.mem.asBytes(&ubo);
    const cur: *anyopaque = self.uniform_buffers_mapped.?[self.current_frame];
    const cur_ptr: []u8 = @as([*]u8, @ptrCast(@alignCast(cur)))[0..@sizeOf(uniform_buffer_object)];
    @memcpy(cur_ptr.ptr, ubo_ptr);
    ```
    I'm not sure if there's actually an easier/better way to do this, but this made it work and now I can go happily to sleep.

    #Zig #ZigLang #Graphics #Vulkan

    2/2

  4. It was a huge amount of fun to actually compile Zig code to WebAssembly. I wanted to get a good grasp of the details of WebAssembly so I chose to manually create and export symbols and directly use them in JavaScript, rather than using some tool that automatically generates bindings.

    #Zig #ZigLang #WebAssembly #Wasm

  5. Today I have ported my fractal generator that is written in Zig to WebAssembly, allowing fractals to be created inside the browser. Here's a link to this: rustydev.codeberg.page/fractal

    #Zig #ZigLang #WebAssembly #Wasm #Fractal

  6. Just wrote a very simple PNG encoder in Zig using only the standard library. It was pretty fun to read up on and understand the PNG file format and to implement an encoder for it in Zig. The standard library makes this pretty easy by providing utilities for compression and calculating checksums.

    #Zig #ZigLang

  7. i'm really enjoying having all my declarations at the bottom of the file, not just imports. it's actually really nice

    #Zig #ZigLang

  8. Updated to zig 0.17.1 and went to rebuild my new favorite text editor flow-control, as one does. It was finished really quickly this time!

    Alas, it produced a segmentation fault.

    I has a little sad now. Downdating to 0.17.0 makes "everything ok" again.

    #zig #ziglang

  9. zpinger - a small ping monitor with a 24-hour web view and a live mtr-style traceroute; one static zig binary, shipped as a .deb; no foreign dependencies

    github.com/zaxified/zpinger

    zpinger.dalimilzak.cz/

    #zig #ziglang #claude #claudecode

  10. Recently I have been working on a simple fractal generator in Zig. Today I have got colours working using a Bézier curve for the gradient, and managed to create this pretty damn cool Sierpiński triangle.

    #fractal #fractalart #generative #generativeart #sierpinskitriangle #zig #ziglang

  11. This is freaking cool.

    Yet no one ever discussing or talking about typeclasses and functional programming ever mentions the magics that #scala does and the powerful systems it has.

    ---

    We have Traits at Home | Lobsters

    lobste.rs/s/05xrj8/we_have_tra

    #zig #ziglang #fp #functionalProgramming #plt #programmingLanguages

  12. 🚀 GitRoot 0.5.0 is out!

    GitRoot the lightweight, self-hosted git forge, without database but a lot of plugins.

    True to its motto "Move slowly, and take care of things" this release focuses on deep craftsmanship rather than the AI race.

    Key highlights:

    • 📦 Breaking PURL: Migrated plugin URLs to the ECMA-427 standard.
    • 🛡️ Anonymous Anti-Spam: New branch limits to prevent spam/abuse without registration.
    • ⚡ Zig SDK: Plugin development now supports Zig alongside Go, Rust, and AssemblyScript.
    • 🛠️ Plugin Power-Ups: HTTP requests, cron-based job scheduling, and flexible callFunc configs.
    • 📂 SFTP Support: Easily manage your repo's web files using your existing SSH keys.

    Check out the official blog post for all the details: https://gitroot.dev/blog/version-0.5.0.html

    #FOSS #SelfHosted #Forge #OpenSource #ZigLang #Wasm

  13. @argv_minus_one
    Why not give a chance to zig ? The foundation which maintains this tool is aligned to your ideas about slop ziglang.org/

    #ziglang

  14. The talks from Software You Can Love Vancouver 2026 are out!

    youtube.com/playlist?list=PLOe #ziglang

  15. CW: trying out zig (programming language), reacting

    I like #ZigLang so far, but I find the aversion to inheritance irritating. I understand that people feel burned by all the problems that come from misusing the feature—but it feels childish to me when a language refuses outright.

    Looking past that, I think I like the way it handles memory allocation. It feels powerful and intuitive, yet safe, in a way that rust never really managed for me.

  16. Zig 0.17 advances the systems programming language with ELF linker work, build system changes, LLVM 22, glibc 2.44, and more.
    linuxiac.com/zig-0-17-programm

    #ziglang #opensource #programming

  17. I like that they now have a thing called Build Server Protocol (BSP) which I read a bit but I'm under the impression has nothing to do with the BSP the #scala people invented - build-server-protocol.github.i | jetbrains.com/help/idea/bsp-su

    If it is the same thing I haven't found single link to it yet.

    😅

    #ziglang

  18. Maybe the conventions are different in Zig, but I would absolutely not expect that a slice comparison function in a module called `mem` would care about the type of the values in it.

    #Zig #ZigLang

  19. I think it's high time to check Zig once again.

    With current stance against LLMs and other stuff this language is looking better and better in my eyes. Last time I was comparing it with Rust, I ended liking Rust more due to how easy was to make a simple hobby project with it and how much software I can potentially contribute to knowing this language. But Rust's strongest point – having crate for almost every single task in programming is related to the point I don't like in Rust – crates.io, a big central place for crates which is an obvious target for supply chain attacks, like in case of PyPI and npm. While I understand rationale behind having small std library and delegating more to third party libraries, which in result leads to need for having them easily accessible for the best developer experience. I still prefer something else. I think I like the way Go does it more, and I think Zig is doing something similar but I'm not sure.

    And now, from what I know, some of big and important crates are allowing LLM contributions, which leads to avoiding using LLMs as much as possible, being a hard task when using Rust.

    I expect stronger #NoAI stance of the Zig project might lead to fostering community, I might be interested in participating in. But IMHO Rust's policy is not that bad, so I'm still not really sure which language I prefer.

    Also the whole thinking about which language I like more is probably just me wasting time, as I'm currently using C++ most of time due to my job and other stuff. But if I ever have chance to use something else, I would like to have some opinion ready. As much as I like Hare, I think this language might not be an option when the opportunity would happen in my job.

    My biggest grief with Hare is that I'll probably never have an opportunity to use it professionally…

    EDIT: Check discussion in replies about pros of centralized repos like crates.io, as my point about decentralized ones being more resilient to supply chain attacks might be complete bullshit. I've just learned about new possibility.

    #Zig #Ziglang #Harelang #Rust

  20. My experience with the #Zig programming language. New entry in my blog!

    macias.info/entry/202609300900

    #ZigLang

  21. Working on learning the Zig programming language (currently by implementing the pipewire client API). If anyone else wants to chat Zig, I made the following chat room on the Jabber network:

    [email protected]?j

    #XMPP #Jabber #Zig #ZigLang

Share on Mastodon

Enter the server where you have an account.