Zig programming language as First-class citizen

Zig is relative new young language - latest verion 0.14.0 (2024-11-05).

Zig is not going to replace C - the main goal is to work together:

Currently it is pragmatically true that C is the most versatile and portable language. Any language that does not have the ability to interact with C code risks obscurity. Zig is attempting to become the new portable language for libraries by simultaneously making it straightforward to conform to the C ABI for external functions, and introducing safety and language design that prevents common bugs within the implementations. Why Zig ...

Most embedded systems are using C. There were attempts to add Rust.
Jacob Beningo wrote about Rust Adoption in Embedded Systems

...established teams are not adopting Rust...The teams that are using C are very interested in moving to C++. C++ adoption makes sense because it’s a modern language that allows teams to leverage the intellectual property they’ve already developed.

I absolutly disagree with the usage of C++ instead of C.

Zig adoption makes sense because it’s a modern language that allows teams to leverage the intellectual property they’ve already developed.

Adree 100% :smiley:

What will this give to OpenWRT?

New developers ("fresh blood") , because developing on

  • open source
  • embedded linux
  • using modern language
    is funny

Does OpenWRT community need such innovation?

CLARIFICATION - i am talking about user space(application) development

Due to https://en.wikipedia.org/wiki/Path_dependence C is going to stay around forever.

Programming language of the week is not going to change that.

3 Likes

no problem - it was my question - do you want or are you ready for something new

just ask juniors ...

It’s always exciting to see new programming languages like Zig. But you have to ask what value it actually adds to an ecosystem like OpenWRT.

Sure, you can write add-on packages or toolchain support in any language, but for the Linux kernel itself, it’s all about C and possibly Rust in the future. But even then, Rust will only be used for device drivers and possibly loadable kernel modules.

actually i am talking about user space development

and as far as i understand, rust is not suitable for kernel development

Yeah, for user-space development, it should work just fine, like any other programming language. As for Rust in the Linux kernel, it's still a work in progress:

I personally think Zig doesn't really have enough market share to make me personally consider it. It is still pretty new and I would be careful to jump on it to fast.

If you are looking for a C alternative I would go full Rust. The end binaries are big but you can strip them down. Also it is very performant and comparable to C in most cases. Rust also has the advantage of being very popular which means there are going to be a lot more help resources.

What zig has to do with rust? The article you refer to looks like glued together paragraphs. Openwrt is decades behind adopting java. What would you do about it?

We're kind of bound to what happens upstream with the core code and packages...

2 Likes