I already have a lot of experience with C# back in the day, and after having done quite a bit of research, I settled on Rust (for it's versatility, speed, strong type & memory usage checking, and excellent tooling) and OCaml (for its functional programming strength, expressive typing, use for DSLs, and stability). I'd like to use Rust as my general purpose language, and Ocaml to write Rust code generators and DSLs.
However, the more I learn Rust, the more I am baffled by choices made regarding syntax and type/memory use checking. The syntax seems excessively redundant and low level, with implementation details leaking all over the place. One example is at [1]. Another example is at [2], where there is this quote:
> ...why should a reference to the first element care about changes at the end of the vector? This error is due to the way vectors work: because vectors put the values next to each other in memory, adding a new element onto the end of the vector might require allocating new memory and copying the old elements to the new space, if there isn’t enough room to put all the elements next to each other where the vector is currently stored. In that case, the reference to the first element would be pointing to deallocated memory. The borrowing rules prevent programs from ending up in that situation.
The explanation makes sense, but the larger question is: why should low level implementation details affect syntax at this level? Why can't references be updated automatically when a vector is moved?
I also don't get this whole complexity about string handling (e.g., string slices vs regular strings). I've read the docs several times and I still don't really get why this design is necessary.
The whole language just seems unnecessarily complicated, quite a contrast to the cleanness and elegance of Ocaml. Can't we have a simpler syntax and design layered on top, probably with a GC as an option?
[1] https://stackoverflow.com/questions/68725942/is-a-mut-on-a-moved-function-parameter-leaking-implementation-details-to-the-f
[2] https://doc.rust-lang.org/stable/book/ch08-01-vectors.html