4 ms·
Most of these productivity gains are achievable in any Standard ML influenced type system.
by pjmlp 1y ago
Most of these productivity gains are achievable in any Standard ML influenced type system.
- bryanlarsen 1y agoThe main difference between Rust and other languages with a Standard ML influenced type system is that Rust has features that can let you get executive sign off for switching languages.
- binary132 1y agowhat is the main advantage of Rust over OCaml for most applications in this respect?
- maleldil 1y agoEcosystem. It's much easier to find libraries for Rust.
- pjmlp 1y agoopam has plenty of libraries, we should not mix quantity with quality. Also we don't need leftpad like libraries, which is the direction Rust seems to be going when I try some some basic application that has like 50 crate dependencies.
- binary132 1y agoRust is very difficult for most people, so do you think that this advantage outweighs that disadvantage? Is that really the only meaningful advantage if you’re not writing a driver or internet-facing compressor at scale?
- pjmlp 1y agoNot really, at my job Scala, F#, Swift and Kotlin are possible, and most likely will never do Rust, other than using JavaScript tools written using Rust, just because. There is nothing in our domain of distributed systems based on SaaS products, mobile OSes, and managed cloud environments, that would profit from a borrow checker.
- wk_end 1y agoThe example that the article gives relies on the borrow checker, which is not part of the usual Standard ML type system.
- pjmlp 1y agoIt is called affine type system, and there are ML descendents with it. You can even go more crazy with linear types, effects, formal proofs or dependent types. What Rust has achieved, was definitely make these ideas more mainstream.
- deleted 1y ago[deleted]
- user____name 1y agoCan the type system catch such things across translation unit boundaries? I know this is a big limit of C like compilers without whole program compilation.
- tialaramex 1y agoUltimately the answer is just "Yes". You know how an array of six integers is a different type from an array of three integers even though they're both arrays of integers ? If you're unclear on that it's worth a moment to go refresh, if your only experience is in C it's a deep dive - no trouble it's valuable knowledge. In Rust lifetimes for references are part of the type, so &'a str and &'b str could be different types, even though they're both string slice references. Beyond that, Rust tracks two important "thread safety" properties called Sync and Send, and so if your Thing ends up needing to be Send (because another thread gets given this type) but it's not Send, that's a type error just as surely as if it lacked some other needed property needed for whatever you do with the Thing, like it's not totally ordered (Ord) or it can't be turned into an iterator (IntoIterator)
- phkahler 1y ago>> any Standard ML influenced type system Which languages are those?
- pjmlp 1y agoWhile I assume it is a loaded question. Caml Light, OCaml, Miranda, Haskell, Coq, Agda, Lean, Scala, Swift, F#, F*, Idris, ATS, and naturally Rust.
- love2read 1y agodoes this actually mean anything more than using a type system?
- lmm 1y agoYes, at least to people who haven't used it. Many C++ or Java programmers think their language has a type system. Even some Python or Ruby programmers do.