Most active commenters
  • pjmlp(5)
  • binary132(3)

←back to thread

517 points bkolobara | 18 comments | | HN request time: 0.482s | source | bottom
1. pjmlp ◴[] No.45041965[source]
Most of these productivity gains are achievable in any Standard ML influenced type system.
replies(4): >>45042039 #>>45042138 #>>45043180 #>>45043371 #
2. bryanlarsen ◴[] No.45042039[source]
The 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.
replies(2): >>45042133 #>>45042166 #
3. binary132 ◴[] No.45042133[source]
what is the main advantage of Rust over OCaml for most applications in this respect?
replies(1): >>45046599 #
4. wk_end ◴[] No.45042138[source]
The example that the article gives relies on the borrow checker, which is not part of the usual Standard ML type system.
replies(2): >>45042189 #>>45042200 #
5. pjmlp ◴[] No.45042166[source]
Not 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.

6. pjmlp ◴[] No.45042189[source]
It 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.

replies(1): >>45043049 #
7. user____name ◴[] No.45042200[source]
Can 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.
replies(1): >>45042496 #
8. tialaramex ◴[] No.45042496{3}[source]
Ultimately 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)

9. ◴[] No.45043049{3}[source]
10. phkahler ◴[] No.45043180[source]
>> any Standard ML influenced type system

Which languages are those?

replies(1): >>45048950 #
11. love2read ◴[] No.45043371[source]
does this actually mean anything more than using a type system?
replies(1): >>45051668 #
12. maleldil ◴[] No.45046599{3}[source]
Ecosystem. It's much easier to find libraries for Rust.
replies(2): >>45048934 #>>45063104 #
13. pjmlp ◴[] No.45048934{4}[source]
opam 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.

14. pjmlp ◴[] No.45048950[source]
While I assume it is a loaded question.

Caml Light, OCaml, Miranda, Haskell, Coq, Agda, Lean, Scala, Swift, F#, F*, Idris, ATS, and naturally Rust.

15. lmm ◴[] No.45051668[source]
Yes, 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.
16. binary132 ◴[] No.45063104{4}[source]
Rust 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?
replies(1): >>45070234 #
17. maleldil ◴[] No.45070234{5}[source]
You're greatly overrating how difficult Rust is. The wealth of high-quality software being written in it shows many people think it's worth the effort.
replies(1): >>45076277 #
18. binary132 ◴[] No.45076277{6}[source]
most people can barely stumble their way through a one and done Python script