Hacker News new | ask | show | jobs
by GlitchMr 2830 days ago
Well, that's mostly because there are almost no ugly parts in Rust. Sure, you can find minor annoyances like those:

- Type inference pretty much being killed by method calls. For instance, code like this won't work:

    fn x() -> Vec<i32> {
        let mut x = (0..3).collect();
        x.sort(); // Calling any method of Vec
        x // Cannot infer that `x` is `Vec<i32>` because a method was called
    }
- Turbofish syntax is ugly. For instance, in Rust you say `std::mem::size_of::<T>()`. It would be nice if you could replace `::<` with `<`.

- Negative modulo follows C semantics. This means `-2 % 12` is `-2`, not `10`. There is a sane implementation in `mod_euc` method, but it's not the default.

- Lexical lifetimes reject code that should be valid necessitating weird workarounds. NLL will fix that one.

- Trait objects types used to be written using a trait name like `Display`. There is a new syntax which is more clear: `dyn Display`, but for backwards compatibility reasons the old syntax is accepted.

- Macros (including procedural derives) cannot access private items in a crate, requiring workarounds like exporting private items in a crate, and having `#[doc(hidden)]` attribute to hide them from documentation.

- Trait version incompatibility issue. That one is weird, but essentially it's possible for a program to have two versions of the same library. It's possible for a library to say, have a function that requires an argument implementing `Serialize` interface from serde 0.9. If you try to implement `Serialize` interface from serde 1.0 then you will get an error message complaining about not implementing `Serialize`, despite you having implemented it, just in the wrong version of a library.

- Missing higher kinded polymorphism.

- Missing const generics.

- The compiler is slow. Like, really slow.

- The language is hard to learn because of many complicated features like ownership and borrow checking. That said, I think those features are a good thing, I'm missing those in other programming languages, but they are problematic when you are learning the programming language.

But really, there is much more I would complain about in other programming languages, so it's not that bad.

1 comments

I would add:

- RC<RefCell<data>> for lambdas to access struct data, specially painful on GUI callbacks

- lack of support for binary libraries on cargo