1. 41

  2. 4

    Safe, yes, but I don’t think the widespread use of syntactic elements like !, | and & is beautiful.

    1. 6

      Rust beauty is about making hardware do exactly what you want, and not about expressing mathematicalish abstractions as crisply as you want. Both kinds of beauties are valid, but the second one is just not a goal of Rust.

      Rust is relatively sigil-heavy, because it needs to express distinction between owned, shared and exclusive access, which for a higher level language all are just values.

      Of course it would be better if we could have both, but it doesn’t seem possible with our current level of programming language technology.

      1. 2

        I don’t know exactly what xyproto was thinking would be better, but perhaps words over symbols?

        It looks quite like a lot of ‘line noise’ to me too, but I think that’s just because I’ve not been immersed in Rust. I thought the same about Elixir until I’d used it for a couple of months.

    2. 1

      Short and expressive. Nice! I plan to share this with my C++ devs in the next days.

      1. 1

        Why not just use an atomic for the second example?

        1. 7

          It’s rather “why integer counter, instead some more real world data structure?”, as I wanted to show mutex specifically.

          Similar point can be made about atomics: Rust allows non-atomic load at the end, but requires atomic loads from other threads. But I felt that a mutex is a better illustration because it is more boring, and because it shows nice RAII guard API.

          1. 3

            The second example extends to any data type.