DEV Community

Discussion on: Pitch me on Rust

Collapse
 
abhinav1217 profile image
Abhinav Kulshreshtha • Edited

Its a programming language with re-imagined programming paradigm.

Here is what I mean,
C is great language that was created about 50 years ago. So asynchronous calls, sugar-syntax, generics, were all added to the language when there was high demand for it. There are many attempts to create a language that is basically update to C. Like zig, nim, D, C++, All these are languages that are trying to improve C

Rust is not trying to be incremental update to C, It is a language that was created after analyzing 50 years of history of C. It is not trying to be a better C, it is a separate language that has learned all the caveat's of writing safe code, and implemented it as a core language structure. Writing safer code is not a coding practice, its only way to code.

Instead of talking about allocation of memory (which nowadays is handled by api hooks in kernel and ssd/hdd drivers) we talk about ownership of that memory block, This makes more sense in modern computing world.

In traditional languages, it is a safer practice to make sure your variables are immutable as needed. But in Rust, variables are immutable by default, and you need to make it mutable if you need it to be. Strings didn't exists 50 years ago, it does now. Co-routines were only usable if you had multi-core processor, but now, multi-core processor is ubiquitous, so it makes more sense to design the language with lambdas and asynchronicity as a first class language feature. Switching to safer defaults instead of reliance on developers knowledge to write safe code allows for a more secure ecosystem.

But most important feature of modern languages like elm, kotlin, rust; over traditional languages like js, java, C; is the first party tooling around it. Code formatting is not a 3rd party tool someone wrote based on his opinion, it is provided by the people who created the language, making sure that new formatting rules is available from day 1. Documentations parsing, bundling and packaging tools, job runners, informative errors, error sniffing and fixing, these are all available with the language itself. We don't have to wait for some 3rd party lsp, to catch-up to new language features.