Sunday, July 23, 2023

Rust - I give up!




 For the last 2 months I've been trying to use the Rust language. In the beginning it looked promising - get the performance of a C++ code with a better stability, simpler memory management, everything solved at compile time, and not sorrow hours of trying to solve a memory leak/overrun in runtime.

BUT...

As I've stepped through the Rust Book,  I've discovered the complexity of the compiler getting higher and higher. I've spend hours creating a code that in other programming languages I can do in 5 minutes. It make no sense.

Not only that, I've also discovered the "Smart Pointers" chapter, and the formal declaration:

"

Rust’s memory safety guarantees make it difficult, but not impossible, to accidentally create memory that is never cleaned up (known as a memory leak). Preventing memory leaks entirely is not one of Rust’s guarantees, meaning memory leaks are memory safe in Rust.

"

Oh really?? So why should I spend my time on this? As the applications in Rust get more complex, we are forced using smart pointers, and lose the memory magic of Rust. Suddenly I feel much less motivated to spend time on solving complex compilation when I get almost nothing for this.


To sum:

While Rust is great for simple tasks, such as string parsing, regex pattern, and a short lived tasks that do not save object oriented state in the memory, we can use rust. In such case the compiler complexity is somehow relatively small pain. 

In case we want complex state using object oriented design, do not waste time on rust. Instead use Java or Go or even C++. 



No comments:

Post a Comment