14 ms·
After using Rust a lot, the borrow checker is not that bothersome actually. Exist MANY more things that are far more significant as causes to fear Rust: - Is a
by mamcx 5y ago
After using Rust a lot, the borrow checker is not that bothersome actually. Exist MANY more things that are far more significant as causes to fear Rust:
- Is actually complex language!
- It has weird, inconsistent inter-mixed between traits, generics, macros, procedural macros, elides, alias, type alias...
- The ways async/await is introduced, multiply the complexity, is super-infectios, and I can't say you can do "fearless concurrency" anymore.
- Is slow to compile!
A "nicer" Rust is actually easy to grasp:
- Borrow checker, xor mutability stay. Is good
- Structs, Traits, Enum, Pattern matching, iterators
- Add generators, PLS!
- A simpler module system
- One single way to do macros, hopefully like Zig
- Probably everything auto-clone (and maybe the compiler elide it for "copy" types).
- Pick a more ergonomic async/concurrency story like Go or Lua. Whatever that is not the complexity of today
I think this is all...
- tialaramex 5y agoI'd like generators too. You'll notice that yield is reserved (although of course unlike C++ Rust actually can just take new keywords anyway, because it has a way to spell identifiers that are now keywords) so one day Rust will likely have generators. But you can't have one way to do macros unless that way is proc macros or you're willing to give up on the power of proc macros. The proc macro is just much too powerful (and thus dangerous) to give people something else and have it be satisfactory. And I don't think auto-clone is a good idea. That's a potentially expensive operation, it's worth taking the time to admit to yourself that you are choosing to pay that price when you use it. This also means when you forgot that you'd need a clone you're reminded there and then (by the resulting diagnostics) to make the decision, whereas with auto-clone in those cases it just mysteriously has worse performance than you expected (because there's a silent clone)
- rightbyte 5y ago> although of course unlike C++ Rust actually can just take new keywords anyway, because it has a way to spell identifiers that are now keywords C and C++ introduce new keywords all the time, by prefixing them with "_" and a capital letter. If you want the nice spelling you need to use a header. E.g. "_Complex". "co_await" etc are operators.
- tialaramex 5y agoIt's possible you're one of the two kinds of "C/C++ programmers" and so you've assumed that since this is how C prefers to introduce things it must be how C++ does it too, but not so. C++ 20 introduced concepts. In C++ 17 "concept" is a perfectly reasonable name for an identifier. Maybe it's a class, a variable, a free function, all fine. In C++ 20 that's a reserved word and can't be used as an identifier. Rust does not have this problem, a 2015 function named "await" is somewhat annoying to use from Rust 2018 or later where "await" is a keyword, but it's only annoying it isn't actually difficult.
- mamcx 5y ago> And I don't think auto-clone is a good idea. yeah, thinking better I must have say "everything is auto-Rc or Arc backed" or similar.