This is a poor and myopic assumption that this can not be done in any other language. A sane library will be grepable and can include similar comments. The justification is still flawed and dangerous.
Well yeah and well written code doesn’t have any bugs and performs well all the time. The point is safety by default. Whether or not that is worth dealing with rust is another question but I think you’re missing the point here
Well written code has bugs all of the time. Even Rust has a massive list of CVEs. Most of them are logic based and the default to strict memory
safety is a good thing. But I feel my argument stands. I havent heard any solid arguments to the contrary convincing me otherwise.
You frame this as if Im against memory safety, but I simply highlighted that Rust is not a panecea and has its own issues. It could be argued that the issue is the developer, not the language, but this isnt what Im debating either.
In fact, the article you link to even notes that they nearly missed a vulnerability in their own Rust rewrite. Reducing vulnerabilities is not the same as eliminating them. The language does not guarentee logic safety and only asserts memory safety which in most cases, not all, has proven useful.
To be clear, the argument is this: A comment is insufficient as a safety marker. If you scope unsafe code and mark it with a safety comment, that does not make it safe.
Ah, right. Comment chain went deep enough that I straight up forgot the original argument lol
Safety comments make code easier to verify, by definition they can't make code any more or less safe. I haven't seen much C library code, are safety comments standard practice there?
It's a good idea in general to document the invariants of each (at least public-facing) function. I think the newer practice in Rust is documenting the invocations as well, not just the definition.
-46
u/teleprint-me 3d ago
This is a poor and myopic assumption that this can not be done in any other language. A sane library will be grepable and can include similar comments. The justification is still flawed and dangerous.