What would be the Zig language?

Asked

Viewed 93 times

-1

  • What is Zig? And what is it for?

  • Is this a new version of Rust? 'Cause it looks a lot like Rust. It’s a clone?

  • It’s better than C/C++?

  • If the question is misspelled, in addition to the negative note please try at least to claim on, so that it can be improved.

1 answer

2


What is Zig? And what is it for?

Zig is a multi-paradigm programming language, developed by Andrew Kelley in mid-2015/2016 as Hobby (claims the author), with the intention of becoming an alternative to the C language. Although the syntax remembers a lot Rust and Go, also has features similar to C language with manual memory management, but does not have a standard form for it (the programmer will have to choose which allocator to use) and follows the language concepts Jai (programming language - pilot [never released] designed by Jonathan Blow).

Just like the language Go, both the language and the compiler share the same name. The compiler is a variant of the Clang compiler "Fork" [supporting cross compilation] of the LLVM project with native caching system, that is, you do not need to use ccache or similar. Then you can also compile C projects with zig cc and C++ with zig c++ (when I use a project with Cmake for example, it detects the executable zig like Clang Compiler).

Is it a new version of Rust? It’s better than C/C++?

No! It’s a new language, bringing new approaches inspired by other languages such as Rust and Go. If being better means performance and/or safety, no. But if it’s legibility and practicality, then yes. As with C, Zig tries to remain minimalist in resource quantities, unlike C++ and Rust and their various abstractions. You can understand better here.

I could say in this case that:

It’s easier to recompile any C/C++ project with Zig, than rewriting it in Rust or any other language.

More information:

Browser other questions tagged

You are not signed in. Login or sign up in order to post.