3 ms·
The failure modes of "can't get code to compile" and "something weird and possibly exploitable could happen at runtime" may both be frustrating to developers, b
by roca 7y ago
The failure modes of "can't get code to compile" and "something weird and possibly exploitable could happen at runtime" may both be frustrating to developers, but they're worlds apart in practice. Looking at it from the point of view of a kernel maintainer evaluating submissions, the former is not your problem --- in fact it keeps the bad code from ever coming to your attention --- but the latter creates ongoing problems for you.
- rcthompson 7y agoThis is an interesting point I hadn't considered before: converting run-time failures to compile-time failures is already desirable on its own, but in the context of submitting a patch/pull request to an existing piece of software, it also results in shifting more of the maintenance burden from the person evaluating the submission to the person submitting, since presumably they will usually not submit their patch until it compiles cleanly. I wonder if easing the maintenance burden of beleaguered open source maintainers is an even larger benefit in practice than catching errors at compile time.
- CountSessine 7y agoThis is true, but there's also a lot of trivial busy-work and confusion that the compiler and language foist on you that isn't security related. Like the fact that you always seem to have a &str when you actually need a String or vice-versa and your code is littered with .to_string() everywhere. Or figuring out what type your iteration is at a particular stage and why you can't call map() on it. Or figuring out the vicissitudes of what collect() will accept and convert for you and what it won't. Or clumsily dealing with a Vec of Results when what you really want is a Result with a Vec Having a really sophisticated type system means...dealing with types a lot. I love Rust - especially ADTs and everything being an expression - but I wouldn't call it more productive than C++. And I think that was mikekchar's point?
- mplanchard 7y agoJust wanted to make sure you knew, you can use `.collect()` to convert an iterable of results into a Result with an iterable. See the 6th example here: https://doc.rust-lang.org/std/iter/trait.Iterator.html#examples-24 https://doc.rust-lang.org/std/iter/trait.Iterator.html#examp...