←back to thread

177 points signa11 | 3 comments | | HN request time: 0.724s | source
Show context
kstrauser ◴[] No.42160831[source]
Rust was a pain in the ass until I stopped trying to write C code in it and started writing idiomatic Rust. I don’t know the author of this blog, but he mentions extensive C++ experience which makes me wonder if he’s trying to write C++ in Rust.

Maybe not! Maybe it’s truly just Rust being stubborn and difficult. However, it’s such an easy trap to fall into that I’ve gotta think it’s at least possible.

replies(3): >>42160844 #>>42161027 #>>42161181 #
nicce ◴[] No.42161027[source]
I learned Rust before learning C properly.

Oh boy. I see bugs everywhere in C and why the borrow checker exists. It really forces you to understand what happens under the hood.

The most issues in Rust are indeed related the expressions - you don't know how to describe some scenario for compiler well-enough, in order to prove that this is actually possible - and then your program won't compile.

In C, you talk more to the computer with the language syntax, whereas in Rust you talk to the compiler.

replies(3): >>42161173 #>>42161240 #>>42162370 #
kanbankaren ◴[] No.42161173[source]
> Oh boy. I see bugs everywhere in C and why the borrow checker exists.

Any examples that you could provide? I have been dealing with C/C++ for close to 30 years. Number of times I have shot myself with undefined/unspecified behavior is less than 5.

replies(5): >>42161886 #>>42162308 #>>42162360 #>>42162444 #>>42164671 #
1. eddd-ddde ◴[] No.42164671[source]
Clearly you must be superhuman then, something as simple as forgetting a null pointer check is bound to hit you every now and then.
replies(1): >>42164757 #
2. kanbankaren ◴[] No.42164757[source]
Of course, I do, but they are caught early in the dev. process. Not in production though.
replies(1): >>42165006 #
3. kstrauser ◴[] No.42165006[source]
I would contend that’s an unusually sophisticated dev process not used by most.