Development

Whoa! What is Zig?

by Peter
what-is-zig

STOP THE PRESS! The Stack Overflow 2023 Developer Survey has arrived!

My biggest takeaway? Put everything down and learn Zig!

“Whoa! What is Zig?”, was my immediate reaction. I’ll get to that but first here are the highlights from the survey that brought it to my attention:

Just out of interest the top five paying skills in 2023 are

  1. Zig
  2. Erlang
  3. F#
  4. Ruby
  5. Clojure

Zig Language

To quote the Zig language Wikipedia page:

Zig is an imperative, general-purpose, statically typed, compiled system programming language designed by Andrew Kelley. It is intended to be a replacement for the C programming language, with the goals of being even smaller and simpler to program in while also offering modern features, new optimisations and a variety of safety mechanisms while not as demanding of runtime safety as seen in other languages. It is distinct from languages like Go, Rust and Carbon, which have similar goals but they also target the C++ space.

It is a general-purpose, non-garbage collected, and portable language that uses pointers – much like C. Currently, C serves as the foundation for many programming languages, including Java, JavaScript, and Python. However, Zig offers the potential for a safer, less buggy, and easier-to-maintain alternative to C. If Zig were widely adopted as a replacement for C, it could have significant systemic advantages in terms of improving programming infrastructure and bringing about substantial benefits.

The language enables developers to work directly with system memory, which is crucial for writing highly optimised code. This characteristic is shared with the C family of languages, allowing programmers to have fine-grained control over memory allocation. Zig’s “close to the metal” nature enables developers to create code that can be optimised to its specific task by directly managing memory resources.

While Zig 1.0 is not scheduled to drop until 2025, it is being used for current real-world applications. Two of the most prominent are:

  1. Uber, for their arm64 infrastructure services.
  2. Bun, last year’s hotness – a NodeJS alternative, is written in Zig.

See also the official Zig website, GitHub repo.

Should you jack in your current gig and get on the Zig train?

NO, definitely not. It’s important to clarify that this situation is not comparable to the early days of Bitcoin, where you could potentially miss out on significant financial gains. In the case of Zig, taking a longer-term view and being cautious about making sudden career changes is advised, as the potential rewards are probably not as dramatic 😂

Remember, there is no one “best” programming language for everyone. The choice depends on your goals, preferences, and the specific context of your career. Continuously learn and adapt as the technology landscape evolves, and be open to expanding your expertise beyond a single language.

Taking the longer term approach

At SRC when considering jumping on a new programming language solely due to its hype among the developer community, it is important to approach the decision thoughtfully and consider the following points:

  • Research and evaluate
    Understand its features, strengths, weaknesses, and the specific problem domains it excels in. Ensure that it aligns with the requirements and goals.
  • Learning curve
    Assess the time and resources to invest in learning and mastering it effectively.
  • Long-term viability
    Consider factors such as community support, active development, industry adoption, and future prospects. You want to ensure that the language will have staying power and continue to evolve.
  • Compatibility and integration
    Evaluate how well the language integrates with your existing tech stack and ecosystem. Consider the availability of libraries, frameworks, tools, and community resources that can support development needs.

Further reading