4 ms·
NaNs have nothing to do with safety (same for nulls). It is a common misconception to conflate safety with functional expectations. A program that only calls p
by jfkebwjsbx 6y ago
NaNs have nothing to do with safety (same for nulls).
It is a common misconception to conflate safety with functional expectations. A program that only calls panic() is perfectly safe.
- arcticbull 6y agoAh sorry, I didn't mean safety in the UB sense, I meant in the traditional, "do what I expect, don't surprise me" sense.
- jfkebwjsbx 6y agoSafety in Rust's context is UB-free, memory errors-free, data race-free. Safety in software engineering is more about designing systems with some degree of assurance against certain failures, but not about surprises or expectations of a programmer. The usage you call traditional is perhaps common, but not really rooted in anything in software engineering. I'd call it an informal meaning, maybe. PS. No need for apologies!
- gpm 6y agoSafety as in unsafe blocks means what you say. But safety as in why so many people use rust is actually what arcticbull says. I think this is something that gets lost on a lot of people who don't use rust. The first form of safety is properly called memory safety. Rust as a language isn't just designed to avoid undefined behavior, it's designed to make you write correct code, where correct means it does what you want it to. Obviously rust doesn't always succeed at that broader goal, but it actually does a pretty good job all things considered. Arcticbull's description of rust's ethos is spot on.