3 ms·
>The problem is becoming a very good programmer who is never tired or rushed. So what stops that programmer from being lazy and wrapping all the blocks in unsa
by ActorNightly 3y ago
>The problem is becoming a very good programmer who is never tired or rushed.
So what stops that programmer from being lazy and wrapping all the blocks in unsafe in a Rust code base?
- adgjlsfhk1 3y agonothing, but a programmer who does so knows they are creating an abomination while in C, it's just a normal day. (and for anyone looking at the code, the rust version will look like a buggy mess, while the C version will look like correct C code).
- ActorNightly 3y agoYeah this doesn't play out in real world. Look at any large enterprise Java project. People take shortcuts and break things all the time, even with fairly strict typing and memory safety. Of course you can enforce things like "no unsafes ever in codebase" on a project, but if you have to reply on guidance for development, then you can simply say "first we write a complete set of tests that are a contract on correct operation, then we develop code", at which point the language choice becomes irrelevant.
- DrMeepster 3y agoBanning unsafe is actually really easy. Just one line `#![forbid(unsafe_code)]` at the start of your code.
- iknowstuff 3y agobottom line is: this doesn't happen. Feel free to study why not.