← Back to context

Comment by bcjdjsndon

11 days ago

[flagged]

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.

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.

  • > Similar to accepting code with empty or nonsensical `catch` blocks.

    You can still find a lot of that in production code though. You're imagining a perfect world where everyone does the correct thing, but id that world existed we would need rust in the first place

    • People using a tool in the wrong way is not necessarily an argument against the tool though. There's always the potential for misuse. (Of course, this misuse should be sharply distinguished from the errors caused by my memory-unsafe features since those will reliably cause errors even if programmers are careful)

      2 replies →

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.

  • Yeah, I'm always told that the Rust community is obnoxious and condescending. But I never actually see it. I do see a bunch of obnoxious anti-Rusters show up every time Rust gets mentioned to complain about it.

    Also not a Rust shill, I used it for a few months about a decade ago. I am a memory-safe-programming-languages shill, though. I know there are good reasons people still use C-family languages (and I'm often one of them) but we should definitely be doing our best to move off them as quickly as we reasonably can.

  • Youve essentially listed the same point four different ways... Rust merely kicks the UB can down the road.

    1. And? The unsafe code could still be memory unsafe

    2. But coders can't be trusted to manually manage memory, otherwise you'd just use c++ right? Doesn't matter whether it's marked unsafe or not, you could do that on c code.

    3. Not in unsafe rust, that's my whole point. There is only vague guidance on correct unsafe rust. (Because they haven't managed to crack the problem, just draw a perimeter around them)

    4. See point 2 rebuttal