4 ms·
It seems that the main problem with Rust is that it has been grown up not from the CS and PL theory fundamentals, like ML, or Scheme or Erlang or even Go, and
by throwaway487548 8y ago
It seems that the main problem with Rust is that it has been grown up not from the CS and PL theory fundamentals, like ML, or Scheme or Erlang or even Go, and it is obviously not a small, clean language everyone loves and appreciates as being beautiful. In other words it is just little better than C++, which is a crap.
If a language could be grown from ML (Ocaml) roots (like Scala) instead of C++, it could be much smaller, cleaner and more pleasant to work with. Rust's only innovation is in the compiler tech, which could be ported and simplified (due to more predictable semantics of a functional language) to any ML-family language.
I cannot overemphasize how beautiful the pattern-matching with local bindings on algebraic data-types is, and what a wonderful thing is Erlang's pattern-matching on receive, and how, say, protobuf is basically product/record-types annotations, which could be done in a ML-family language itself etc.
Rust is under the curse of C++ (a statically typed and standardized dialect of PHP3) if you wish. It is obviously good language compared to C++, but somehow Ruby-ish, compared to ML-family languages.
It is actually a pity that Rust and not ML/Ocaml are considered cool and sexy by modern teenagers (like it used to be with Ruby and with Rails not so long ago). ML is much better starting point than C++. Perhaps, polished to perfection languages (Scheme, Haskell) are less appealing for the crowd being too dry, without ambivalence.
BTW, the next cool language definitely should be something like typed Erlang with Ocaml's syntax ;) - a hybrid into which typed Python or Typescript are growing into.
- nestorD 8y agoI would love to see more ML derived language gain traction (F# being my current favorite) but it has to be said that Rust was first derived from Ocaml : https://fr.slideshare.net/KelCecil/hey-theres-ocaml-in-my-rust https://fr.slideshare.net/KelCecil/hey-theres-ocaml-in-my-ru...
- nchie 8y agoWhile Rust competes with C++ by sharing a lot of goals, it is _way_ closer to ML than C++ is. If it was developed with the goal of being an ML language, my guess is that a lot of what it does wouldn't be possible and it'd end up being another language very similar to OCaml.
- UK-Al05 8y agoRust is ML like. It can do pattern matching and has adt type system. It uses expressions rather statements If you remove gc from ocaml, and added in compensating alternatives it would end up looking something like rust. I think a lot of the adversting around rust in a "better c++" but its actually ocaml like but not mentioned to avoid scaring away traditional systems devs.
- throwaway487548 8y agoRust did a lot of things nice, but it is over cluttered with all these particularities everywhere, which could be hidden by better default conventions. For example, everything should be a reference by default, and use of explicit & is stylistically bad. Or why in let mut iter = a.iter(); iter is mut? It should be a simple closure which follows a protocol. In what sense it is mutable? And such small warts are literally everywhere, together resulting in a clutter. A functional language uniform defaults (everything is an expression, everything is a binding which implies everything s reference) are much better.
- steveklabnik 8y agoIterators contain internal state that gets mutated as you iterate. So it needs to be mutable.
- throwaway487548 8y agoBut the whole idea is that once a closure implements an interface its internal state is strongly isolated behind the abstraction barrier of the interface and no one knows or cares whatever state it has, if any. It is very CS 101.
- steveklabnik 8y agoWell, first of all, it's not a closure, it's a struct, though closures are syntax sugar for structs. Second, what you said is true, but also not really relevant; mutability is part of the API in Rust, and so that is part of the interface. To make it more concrete, https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#tymethod.next https://doc.rust-lang.org/stable/std/iter/trait.Iterator.htm..., the protocol, takes &mut self. So it must be mutable. It's following the principle you're talking about.