Rust lang, the beauty of

April 17, 2021

I used C professionally then moved to C++. Then ended up with C#.

C is still used and I admire their dedication to manage memory and dealing with pointers while fending off security/virus threats.

Then Rust language started to assimilate C programmers. I checked it out and I agree C programmers will be enticed to this language.

Below are my opinions about the language after reading the official book, The Rust Programming Language - The Rust Programming Language (, and trying out writing a quick sort.

Ownership - Memory Management

C#/JAVA/Golang has memory management via Garbage Collection (GC). You are done with the object, and the memory is reclaimed when the framework deemed garbage.

With the ownership, memory management is clear and direct.

Clever way of using the semi-colon (;)

Rust has statement and expression. Semi-colon is the visible indicator that it is a statement (present) or an expression (missing).

Golang has it as optional - and recommended to avoid.

Rust has a good purpose. This also makes it easier C-style language programmers to move to rust knowing without semi-colon is an expression.


Gone is the billion dollar mistake. Tony Hoare This indicates the language is modern and can guide programmer to think for the cases.

Convention for limited setup

Strict module for directory based organization makes sense. In C#, namespaces decouples from the file system which allows it can go wrong. That is, you can move the files without renaming namespace which can cause surprises. .NET framework also does that as well in different dlls. Allowing that flexibility is cool and I wish the language would limit that and rust seems to do that.


Now that I mentioned what I liked, it’s time to bring some concerns. This might be addressed in future but writing code now may get in the way.

Debugging Library Code

Searching the web for debugging rust shows how you can debug a bin project. When it comes to the library project for my qsort, I couldn’t set a break point.

It appears there is no easy way to do that. There’s cargo test to not run and debug the exe. I spent half an hour but didn’t get much out of sporadic information out there.

Hopefully this becomes non-issue with better IDE integration.

Different way of thinking

I was writing like C and I wanted to force it in rust. I wanted to play with array indexes for qsort, I wanted to convert slice index to int then I had to go out of the way.

I decided to stay with uint and I had to change the code to check for 0’s instead of comparing values against negative.

This is forcing a programmer to solve differently. Cutting the half of the negative values for index might have not been the best practice but it’s free to do so.

Perhaps I am too wild for RUST and needs to be “tamed” by the language. When that process ends, I might become a Rustacean.

E.g. Binary searching for an array in C# returns negative value if not found and negating the value returns the index where it would be added to. Well, perhaps I’ve been too tricky with negative values. Python on the other hand can do similar search with bisect and it does not require negative values as it provides the index where it should be.


If you’ve been a C programmer for life, this might be a language for children who can’t play with a knife. There’s less likely to use it as you already have all the library for your tasks including most effective way to manage your own memory in devices.

If you are like me, a lazy programmer with C#/Python/Java, writing code in rust can make you more productive than writing C if you must write it in for one reason or the other (web assembly or system code or small systems). You can learn it then.

If you are new to programming and picked up C to start, good for you. Finish the language tutorials and write small code and jump immediately to RUST if you must or move onto higher programming language later on. C-style language is the backbone for many other languages it’s vital to learn.

© 2023 Kee Nam