Best of Zig2024

  1. 1
    Article
    Avatar of devtoDEV·1y

    I Tried Every Hot Programming Language

    The author compares their experiences working with GoLang, Zig, and Rust through practical projects. They found GoLang easy to learn and reliable, Zig explicit and fast but lacking memory safety, and Rust challenging due to its strict memory rules but ultimately rewarding. The comparison highlights the strengths and weaknesses of each language and concludes that the best choice depends on specific use cases and team preferences.

  2. 2
    Article
    Avatar of omgubomg! ubuntu!·1y

    Ghostty: New Open Source Terminal That’s Spookily Good

    Ghostty is a new open-source, cross-platform terminal emulator created by Mitchell Hashimoto, co-founder of HashiCorp. Featuring a platform-native GUI, Ghostty leverages GPU acceleration and offers a range of modern features including fast startup times, support for multiple windows, tabs, and split panes, GPU-accelerated rendering, and extensive theming capabilities. On Linux, it uses GTK4/libadwaita for its interface and can be compiled from source. Users can install it on macOS via a ready-to-run binary or on Linux by compiling it from source.

  3. 3
    Article
    Avatar of hnHacker News·2y

    fairyglade/ly: display manager with console UI

    Ly is a lightweight text-user interface (TUI) display manager for Linux and BSD that can be compiled using Zig and has various runtime dependencies. It supports a wide range of desktop environments and provides basic Wayland support. Ly is designed to work without systemd and can be installed with systemd, OpenRC, and Runit services. Configuration options are detailed, including changing the default tty and editing the configuration file at /etc/ly/config.ini.

  4. 4
    Article
    Avatar of communityCommunity Picks·2y

    Memory Safety in C++ vs Rust vs Zig

    The post compares C++, Rust, and Zig in terms of memory safety. C++ offers freedom but can lead to unsafe memory practices; Circle C++ provides stricter safety features while maintaining compatibility with existing codebases. Rust ensures exceptional memory safety with a strict compiler and concepts like the borrow checker. Zig strikes a balance with reasonable memory safety and ease of use, making it simpler to integrate into existing projects. Key focus areas include lifetime safety, type safety, and runtime safety, highlighting how each language handles these aspects differently.

  5. 5
    Article
    Avatar of hnHacker News·1y

    Hello from Electrobun

    Electrobun offers a comprehensive solution for building, updating, and shipping fast, tiny, cross-platform desktop applications using Typescript. It leverages bun for executing the main process and bundling webview Typescript, with native bindings in zig. Key features include fast and secure performance, small app bundles, and an integrated workflow.

  6. 6
    Article
    Avatar of communityCommunity Picks·1y

    neurocyte/flow: Flow Control: a programmer's text editor

    Flow is a Zig-based text editor under active development, designed for daily coding tasks. It supports modern terminals with 24bit color, NerdFont, and multiple operating systems including Linux and Windows. The editor features fast TUI interface, tree sitter based syntax highlighting, multi cursor editing, mouse support, and customizable keybindings. It can be cross-compiled for various targets and installed as a single statically linked binary.

  7. 7
    Article
    Avatar of communityCommunity Picks·2y

    Why I rewrote my Rust keyboard firmware in Zig: consistency, mastery, and fun

    After experiencing challenges with Rust, the author rewrote their keyboard firmware in the Zig programming language. Despite having no prior experience with Zig, they found it easier to use and more enjoyable compared to Rust. The author highlights the simpler conditional compilation and type handling mechanisms in Zig, which made their development process smoother. Zig's smaller and more consistent language design allowed the author to be more productive with less mental overhead. This shift provided a new perspective on Rust's complexity and raised appreciation for Zig's simplicity and efficiency.

  8. 8
    Article
    Avatar of lobstersLobsters·2y

    Introduction to Zig

    Pedro Duarte Faria introduces an open-source, project-based book on the Zig programming language, designed for both beginners and experienced developers. The book explores Zig through small projects like a Base64 encoder/decoder and an HTTP Server, covering syntax, data structures, memory management, error handling, and more. Readers can support the project through donations or by purchasing the book on Amazon.

  9. 9
    Article
    Avatar of tnwThe Next Web·2y

    Why Zig has become the highest-paying programming language

    Zig has become the highest-paying programming language as per the latest Stack Overflow survey, with developers earning an average of $103,000 annually. Despite its relative obscurity and small user base, Zig's demand in high-performance systems programming has driven up salaries. Known for its consistent memory management and compatibility with C codebases, Zig is a promising, albeit challenging, language for systems programming, embedded systems, game creation, and more.

  10. 10
    Video
    Avatar of youtubeYouTube·2y

    Zap (Zig) vs Actix (Rust): Performance Benchmark in Kubernetes #207

    This post benchmarks the performance of Rust's Actix and Zig's Zap frameworks when deployed in Kubernetes. The focus is on CPU and memory usage, client latency, and request handling efficiency. The comparison reveals that Rust uses fewer resources and handles more requests before failing. Detailed graphs illustrate the performance metrics, highlighting significant differences in CPU and memory consumption.

  11. 11
    Video
    Avatar of primeagenThePrimeTime·2y

    so i tried ghostty...

    The author shares their initial thoughts on Ghosty, a terminal emulator currently in private beta. They highlight its easy configuration, the quality of its codebase (written in Zig), and the notable engineer behind it. Despite its benefits, the lack of session management requires continued use of tools like t-mux. The author encourages feedback for more tech content.

  12. 12
    Video
    Avatar of primeagenThePrimeTime·2y

    Why I Chose Rust Over Zig

    The author discusses their preference for Rust over Zig in system programming. Although they appreciate Zig for its C-like feel, they find Rust's memory safety, established ecosystem, and more mature tooling make it a more productive choice. The author also points out that Zig's current tooling, ecosystem, and lack of comprehensive learning resources are significant barriers. Despite Zig's potential, Rust’s industry backing and safer, more familiar tooling make it the author's go-to language for now.

  13. 13
    Article
    Avatar of watercoolerWatercooler·2y

    Zig

    Zig is a programming language that focuses on safety, performance, and simplicity. It offers features such as compile-time memory management and optional garbage collection, and aims to be a viable alternative to C. With a focus on predictable and efficient code generation, Zig offers an attractive option for systems programming.

  14. 14
    Article
    Avatar of communityCommunity Picks·1y

    Why am I writing a JavaScript toolchain in Zig?

    The post discusses the creation of a new JavaScript toolchain called Jam, developed in Zig. The toolchain aims to improve upon existing developer tools by leveraging advanced techniques for static analysis, code optimization, and formatting. The author highlights the limitations of current tools like ESLint, proposing more efficient and effective solutions such as lossless syntax trees and compile-time AST query processing. Contributions to existing tools and the potential for future enhancements, including TypeScript support, are also mentioned.

  15. 15
    Article
    Avatar of communityCommunity Picks·2y

    After a day of programming in Zig

    A Rust enthusiast reviews the Zig programming language, highlighting its unique selling points, similarities and differences with Rust, and challenges. The review covers the Zig community and ecosystem, standard library, error handling, C interoperability, comptime, types, and memory allocation. The reviewer praises Zig's tooling, build system, and testing capabilities. Overall, Zig is seen as a well-designed language with great potential for low-level development.

  16. 16
    Video
    Avatar of thevimeagenTheVimeagen·2y

    Tower Defense Against ChatGPT

    The post discusses creating a tower defense game using the Zig programming language and integrating it with ChatGPT. The game involves placing and upgrading towers in a turn-based format, with players voting on the tower positions via chat. The project also involves some challenges and quirks with Zig, and plans to utilize fuzz testing to ensure software reliability.

  17. 17
    Video
    Avatar of communityCommunity Picks·2y

    Ghostty is Probably The Best Terminal Emulator I've Ever Used

    Ghosty, a new terminal emulator by Mitchell Hashimoto, offers unique and powerful features that make it stand out. Currently in private beta, Ghosty addresses common terminal issues with innovative solutions such as window management and customizable text size. Although it has some limitations, like image handling, it shows great potential. A public release is expected soon, with continuous active development and contributions from the community.

  18. 18
    Video
    Avatar of youtubeYouTube·2y

    Actix (Rust) vs Zap (Zig) vs Stdlib (Zig): Performance Benchmark in Kubernetes #208

    The post shares updated performance benchmark results comparing the Actix HTTP framework for Rust with the Zap framework and a pure implementation in Zig. Using a production-ready EKS cluster, the tests measure CPU and memory usage, latency, and request handling capacity under heavy load. The results show Rust leading in request handling at 160,000 requests per second, followed by Zap at 127,000, and the pure Zig implementation showing competitive performance but ultimately lagging at higher loads.

  19. 19
    Article
    Avatar of p99confP99 Conf·2y

    Rust vs. Zig – and C++ and Mojo – for Systems Programming

    At P99 CONF, a debate between Jarred Sumner, Pekka Enberg, and Glauber Costa on ThePrimeagen's Twitch stream explored the benefits and drawbacks of Rust and Zig for systems programming. Key points included Rust's memory safety and robust ecosystem, and Zig's low-level control and better interoperability with C. They also touched on Mojo's potential, particularly for machine learning, and agreed that both Rust and Zig offer significant advantages over older versions of C++.

  20. 20
    Article
    Avatar of communityCommunity Picks·2y

    Error Handling In Zig

    Zig offers a straightforward error handling mechanism via error sets and try/catch. Functions can return errors implicitly or explicitly, using specific types like `anyerror` for handling any error type. While `try` bubbles errors up, `catch` handles them selectively, with patterns for switching based on error types. Zig also includes `errdefer`, which executes only if a function returns an error. However, Zig's simple errors as enum values pose limitations on attaching additional information or behavior, leading some developers to use tagged unions for more complex error handling needs.

  21. 21
    Article
    Avatar of lobstersLobsters·2y

    Why I am not yet ready to switch to Zig from Rust

    The author loves programming in C and has spent a lot of time programming with it. They appreciate that C feels right and the connection it has with machine code. However, C is an unsafe language and has some limitations. The author was drawn to Rust because of its memory safety features, although they initially struggled with the borrow checker. They eventually found Rust productive to work with. The author also explored Zig, which feels like C but at a lower level than Rust. However, they found some issues with Zig, such as the use of comptime, encountering segmentation faults, and memory leaks. Additionally, there are currently no books available for learning Zig, and the ecosystem and industry investment are not as developed as they are for Rust.

  22. 22
    Video
    Avatar of primeagenThePrimeTime·2y

    P99 - Zig vs Rust

    P99 is a highly technical virtual conference focusing on performance with over 60 engineering talks covering topics like Rust, Zig, eBPF, database optimizations, and cloud infrastructure. The discussion includes notable speakers such as Michael Stonebreaker and Brian Cantrill. The post delves into the comparison between Zig and Rust, highlighting their use in systems programming, their learning curves, development speed, and tooling effectiveness. The conference aims to provide deep insights and a good time for enthusiasts of these technologies.

  23. 23
    Video
    Avatar of thevimeagenTheVimeagen·2y

    Trying Zig Part 1

    This post explores learning Zig, setting up the environment, and covers various topics such as arrays, strings, loops, and error handling in Zig.

  24. 24
    Article
    Avatar of communityCommunity Picks·1y

    octopus-foundation/gremlin.zig: A zero-dependency Google Protocol Buffers implementation in pure Zig. Single allocation encode and lazy decode

    Gremlin is a zero-dependency implementation of Google Protocol Buffers in pure Zig, requiring no additional tools like protoc. It supports Protocol Buffers version 2 and 3, integrates easily with Zig's build system, and features single allocation for serialization and lazy parsing. The process involves adding the dependency to your `build.zig` file and specifying the input and output directories for .proto files.

  25. 25
    Article
    Avatar of Karl Seguinopenmymind·2y

    TCP Server in Zig - Part 6 - Epoll

    This guide explores how to build a TCP server in Zig using the epoll system call, which is specific to Linux and offers various advantages over poll. The article introduces the three key epoll system calls (`epoll_create1`, `epoll_ctl`, and `epoll_wait`) and explains how to use them to manage socket events more efficiently. The guide also covers how to associate each epoll event with client-specific data, simplifying client management, and demonstrates how to implement edge-triggered notifications.