4 ms·
Rust has other advantages as well. For example, a common error when something goes wrong in Python is that a 'None' value ends up somewhere where it shouldn't b
by phicoh 3y ago
Rust has other advantages as well. For example, a common error when something goes wrong in Python is that a 'None' value ends up somewhere where it shouldn't be. Typically this None has traveled quite a while before some code tried to use it.
The richer and stricter type system of Rust makes such errors a lot less likely. And if an error escapes, there usually is a way better indication of the origin of the error than just 'None'.
- pjmlp 3y agoMost of those Rust features over Python, that are commonly referred to, are available in any programming language of ML linage. Caml Light, SML, OCaml, Haskell, F#, Scala, and whatever else is out there. Most of them also come with a REPL, and have multiple toolchains, no need for always be waiting for the compiler.
- phicoh 3y agoIt is very nice that those languages have those features. But it is quite rare that people who are used to C or Python code bases are switching to those languages. In particular a strong point of Rust is that C programmers feel comfortable switching to Rust in way that has not happened with other safe languages.
- pjmlp 3y agoC folks hardly change to anything, at least the hardcore ones, unless forced to by external forces. Python well, it isn't as if Rust is on the same level of developer experience and friendliness. With CPython finally getting a JIT, and Mojo, I don't force that happening long term. In any case, hardly changes the fact of not being Rust specific type system features not available anywhere else.
- phicoh 3y agoThere is a huge amount of C programs and libraries that were written in C because back then it was the best tool for the job. A lot of people are not convinced about C++, but for many things that were written in C, Rust is now a good option. More and more people are asking questions about how C programs avoid memory errors. The easy solution is to switch to Rust for new programs and libraries. Python has the problem that large Python programs are often awkward. There are many reasons for that. And somehow the Python community doesn't seem to be able to solve those issues. Rust is a lot better in that respect.
- frou_dh 3y agoMany of those random userspace C programs (i.e. stuff in the (1) manpage section) could have been rewritten in e.g. OCaml just fine ages ago, if only people were paying attention and not in the curly brace mind prison.
- angra_mainyu 3y agoI disagree. It's much more common to go from C to Python, Go or even Zig, rather than Rust. I think the C++ to Rust transition is by far the most common one.
- lelanthran 3y ago> In particular a strong point of Rust is that C programmers feel comfortable switching to Rust in way that has not happened with other safe languages. I don't see this at all. C++ programmers might be switching, but C programmers aren't reaching for Rust when they need something better than C.
- vlovich123 3y agoErgonomic advantages / reduced defect rates != vulnerability issues. The former aren’t a problem for languages like JS which has all sorts of weird sharp edges. But vulnerabilities are treated as a separate risk factor because the issues can spill to unexpected areas which makes risk harder to quantify and reason about. A vulnerability in some small tool that barely anyone uses can be used to exfil your entire customer database or do a ransomeare attack and cost you hundreds of millions of dollars in short term damage + investigations by regulatory bodies and law enforcement. A buggy piece of software at worst causes some bad PR or a failed product which is way way smaller and localized of an issue
- phicoh 3y agoSome classical programming languages that don't suffer from buffer overflow or memory allocation issues, but are horribly unsafe due to type (and other issues) are shell scripts and, at least, early versions of php. Weak type checking at interface boundaries allows for all kinds of errors including vulnerabilities. A famous class of vulnerabilities due to poor type checking is SQL injection.
- pjmlp 3y agoSQL injection happens on any language where people decide string concatenation is better than using precompiled query parameters exposed by database drivers APIs. Using Rust doesn't change how those folks keep concatenating strings.