Hacker News new | ask | show | jobs
by johnisgood 1867 days ago
My opinion: I really dislike Rust's syntax because to me it is similar to Perl's that I also do not like that much as I do not know what is happening just by looking at it (I still like to use Perl here and there, but these days I lean towards Tcl more), it seems hidden from me, even compared to something as C where I have to think about conversions and whatnot.

I can easily read and understand someone's Ada, C, or OCaml code and actually know what is going on, but I cannot read and understand even my own Perl code (after a week or two), or other people's Rust code. I would rather prefer reference implementations to be in C than in Rust, too. If I read the C version, I can easily port it to any language vs. if it were in Rust.

1 comments

Thank you for the answer :-). I'm still surprised because to me, Rust looks a _lot_ like OCaml with curly braces. The surface lexical conventions are mixed with C++ (like `::` for namespacing) but code still looks more like OCaml than C, with `let` bindings, sum types, expressions, `match` being omnipresent. Even the type annotations look more ML-ish than the type-first C convention. I fail to see the relation to perl (there's barely any `$` in rust code! and most sigils are still the & related to references that also abound in C).
I compared it to Perl because of its heavy use of symbols in general. In Rust, you can have 6 symbols next to each other and that is valid code. See below.

OCaml does not look like Rust to me (OCaml seems more consistent, and Rust seems like a mixed bag of everything to me). It does not hide as much behind symbols for example as Rust does, I think, and learning it was really easy. I tried to read Rust, I really did, but everything is so hidden from me. I did not mean to say that any of the mentioned languages are anywhere close to C though. In any case, if I had to look at reference implementations, C would be the best (to me). It is really easy to know what is going on and why, and thus it is easy to implement it in any languages I know. Probably because it is not a language with many high-level abstractions or language constructs (syntactic sugars) that hide what is going on.

Example snippets as to why I dislike Rust:

  let mut parents_array = ArrayVec::<[&[u8; BLOCK_LEN]; MAX_SIMD_DEGREE_OR_2]>::new()

  let input_ptrs: &[*const u8; DEGREE] = &*(inputs.as_ptr() as *const [*const u8; DEGREE]);
And this is nothing, there are much worse ones, and I would have to give you files for that, but pretty much any famous Rust project is difficult to read for me. I really do not understand most Rust code, I wonder if the problem is with me.