top | item 45377247

(no title)

oleganza | 5 months ago

You don't have to play this game - you can always write within unsafe { ... } like in plain old C or C++. But people do choose to play this game because it helps them to write code that is also correct, where "correct" has an old-school meaning of "actually doing what it is supposed to do and not doing what it's not supposed to".

discuss

order

ManlyBread|5 months ago

That just makes it seem like there's no point in using this language in the first place.

maccard|5 months ago

Dont let perfect be the enemy of good.

Software is built on abstractions - if all your app code is written without unsafe and you have one low level unsafe block to allow for something, you get the value of rust for all your app logic and you know the actual bug is in the unsafe code

haileys|5 months ago

This is like saying there’s no point having unprivileged users if you’re going to install sudo anyway.

The point is to escalate capability only when you need it, and you think carefully about it when you do. This prevents accidental mistakes having catastrophic outcomes everywhere else.

pjmlp|5 months ago

Because only lines marked with unsafe are suspicious, instead of every line of code.

Also the community culture matters, even though static analysis exists for C since 1979, it is still something we need to force feed many developers on C and C++ world.