DevotionGeo

DevotionGeo

When and why would you use Zig instead of Rust and vice versa?

Rust
Zig

Most Liked

Exadra37

Exadra37

Zig - Manual Memory Management:

In order to accomplish this, Zig programmers must manage their own memory, and must handle memory allocation failure.

I am not an expert at all in compiled languages, but from the above line in their docs seems to be one of the main reasons to not use it instead of using Rust, at least in my point of view :wink:

I say this because more then 50% of the bugs in C related stuff comes from memory management, and if I am not in mistake the cause of very dangerous exploits.

dimitarvp

dimitarvp

Zig mostly aims to be a C replacement, whereas Rust aims to displace C++.

However, lately Zig’s author started investing in ergonomics and compatibility more – his article on making the Zig compiler integrate with C compilers and using Zig’s unified CLI commands and switches to interact with those legacy C compilers is excellent – so I am not sure what’s his future direction.

I don’t want to fanboy for Rust but it has a very dedicated and hardcore community and it’s IMO only a matter of time before it eats part of C’s lunch (and thus Zig’s),

Not saying Zig is doomed – I liked its demos a lot and the author is extremely talented.

But between Rust being better and better every month and reaching for more and more areas – parts of the embedded / strongly constrained environments included – I am not sure if Zig won’t remain a niche language whose main selling point would be “I am a better C for microcontrollers”.

Could be wrong though – I am simply sharing what I’ve gathered all over the net and through my own experience. Take it with a bag of salt.

AstonJ

AstonJ

Added the Zig portal :nerd_face:

Where Next?

Popular Backend topics Top

New
New
DevotionGeo
Some time ago I read somewhere that Rocket will work with stable versions of Rust. The previous version’s changelog says, “Core: Removed...
New
New
AstonJ
Consider this Erlang code: Rectangle = {rectangle, 20, 10}. {rectangle, Width, Height} = Rectangle. > Width. 20 > Height. 10 When...
New
New
Jsdr3398
I’ve recently become interested in Elixir and all it’s neat perks. And since I’m currently working on a messaging platform; elixir seems ...
New
Jsdr3398
I love how elixir works and some of its perks, but I’m still pretty uncomfortable, especially when mix/hex gets involved. Did anyone els...
New
mafinar
This is going to be a long an frequently posted thread. While talking to a friend of mine who has taken data structure and algorithm cou...
New
New

Other popular topics Top

AstonJ
SpaceVim seems to be gaining in features and popularity and I just wondered how it compares with SpaceMacs in 2020 - anyone have any thou...
New
PragmaticBookshelf
Build highly interactive applications without ever leaving Elixir, the way the experts do. Let LiveView take care of performance, scalabi...
New
AstonJ
If you get Can't find emacs in your PATH when trying to install Doom Emacs on your Mac you… just… need to install Emacs first! :lol: bre...
New
New
husaindevelop
Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New
PragmaticBookshelf
Author Spotlight: Karl Stolley @karlstolley Logic! Rhetoric! Prag! Wow, what a combination. In this spotlight, we sit down with Karl ...
New
First poster: bot
Large Language Models like ChatGPT say The Darnedest Things. The Errors They MakeWhy We Need to Document Them, and What We Have Decided ...
New
PragmaticBookshelf
Author Spotlight: Tammy Coron @Paradox927 Gaming, and writing games in particular, is about passion, vision, experience, and immersio...
New
New
AstonJ
If you’re getting errors like this: psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory ...
New