logoalt Hacker News

bcjdjsndon • yesterday at 2:55 PM • 3 replies • view on HN

[flagged]


Replies

samus • yesterday at 4:45 PM

That's not how "unsafe" works at all. If "unsafe" is so commonplace in a code base that your statement becomes relevant then the project is badly run, and memory safety is just another problem among many others. Similar to accepting code with empty or nonsensical `catch` blocks.

loa_in_ • yesterday at 4:00 PM

You can iterate through all unsafe sections of the codebase by simply grepping for `unsafe`, the rules are followed everywhere else. It's a great improvement.

➕ show 1 reply
benjaminkiefl • yesterday at 5:27 PM

As always the same tropes get repeated ad nauseam.

Rust code using `unsafe` != C code:

-) you can encapsulate `unsafe` internals behind safe interfaces

-) you can concentrate operations requiring manual safety reasoning in small parts of the codebase

-) safety obligations become explicit

-) `unsafe` does not turn off the borrow checker, type checking, ordinary bounds checks, or automatic cleanup and you still benefit from Rust's provided abstractions and its composability

I'm not a Rust shill, and not a single programming language I use is part of my online identity, but if "Rust is a cult", the anti-Rust gang isn't?

Getting more and more annoyed by the latter to be honest.

➕ show 1 reply