Reply to post: Re: Eh?

Rust in peace: Memory bugs in C and C++ code cause security issues so Microsoft is considering alternatives once again

Ilsa Loving

Re: Eh?

>The idea behind languages like rust is you accept that mistakes happen and any performance hit you take is a worthwhile tradeoff for less debugging and reduce risk of these catastrophic bugs.

I disagree with that comment because it feels like you're mischaracterizing what Rust is trying to accomplish. Maybe I am just misunderstanding what you are trying to say. The philosophy behind Rust is that, by the old way of doing things, all these mistakes are guaranteed to happen due to lack of compiler-level enforcement of resources.

Rust is a functional language with one very very key feature: variables have ownership. Assign the value of one variable to another, and the old variable can't use it anymore.

eg (in pseudocode):



print b \\ get 5

print a \\ compiler error because a gave up ownership of its value

That one single concept creates a language that entire classes of programmer errors impossible to perform, because if you make a mistake the compiler itself will detect it. This also makes the resulting binaries faster because the code has been proven proper at compile time and so a variety of runtime checks are no longer needed.

The downside is that the average programmer will have a brief but steep learning curve because they will need to completely rethink how they approach most problems. But IMO the benefits to long term code viability are just so utterly overwhelming that it's worth the effort.

Also, Rust is inter-operable with C so libraries from one can be used in the other

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon


Biting the hand that feeds IT © 1998–2020