4 ms·
In addition, most of these checks are provided in other languages or linters for those languages. E.g. C++ has had RAII before Rust has existed. C++ (with -Werr
by tylerhou 4y ago
In addition, most of these checks are provided in other languages or linters for those languages. E.g. C++ has had RAII before Rust has existed. C++ (with -Werror), TypeScript and most FP languages have exhaustive switch checking. Clang can catch many (but not all) initialization errors. The places where Rust adds value (data races, memory safety, explicit unsafe) are not discussed in the article.
- SemanticStrengh 4y agoI would like to see more about atypical language protections. GCC has many underknown flags that protects against very specific things. Kotlin is the first popular language to support structured concurrency, eliminating many classes of concurrency errors. It's basically "RAII" for threads, coroutines. Tailrecursive and deeprecursive allow for making any recursive function stack-overflow safe.
- pjmlp 4y agoI guess C# isn't popular.
- SemanticStrengh 4y agoIt is of course but I doubt C# has structured concurrency?
- nicoburns 4y agoRust also adds value in providing so many of th checks where most languages only have a subset, and being incredibly consistent in having safe defaults.
- tylerhou 4y agoNot untrue, but the post doesn’t mention prior work, so it’s implying that Rust is one of the only languages that has these features, whereas even C++ (notorious for being unsafe) as a majority of the features (in Clang). Clang can even catch many data race issues with the proper annotations. Maybe it’s ignorance, but given how posts proselytizing Rust tend to get popular on HN, it makes me suspicious that the omission was intentional.
- sgift 4y ago> In addition, most of these checks are provided in other languages or linters for those languages. Linters are inferior to things the compiler catches for the same reason test cases are inferior: They are not enforced. If the compiler doesn't allow something you can say with confidence you will never see it in the wild. With linters, compiler switches (-Werror) or test cases you'll have no idea.