5 ms·
I think everyone agrees that "fighting" the borrow checker is annoying, however at the risk of sounding like a Rust apologist I find that a couple interesting t
by vvanders 8y ago
I think everyone agrees that "fighting" the borrow checker is annoying, however at the risk of sounding like a Rust apologist I find that a couple interesting things have happened over ~2 years with the language:
1. The borrow checker usually kicks in when I want to take shortcuts that would bite me in the future. 90% of issues I hit with it can be solved with copy/clone.
2. When I take the time to satisfy the borrow checker I find my architecture is better. Usually I'm tripping the borrow checker because I don't have a clear single-owner or separation of concerns.
Also, if you're looking for an "easy" to program languages there's tons of them out there and it definitely doesn't make sense in my mind to use Rust where C#/Erlang/Java/etc fit the domain space better.
- andolanra 8y agoThese points are absolutely consistent with my experience. I'd also dispute the author's claim that, "If the language has the problem that people are fighting with the language in order to become productive with it, perhaps something is wrong with the language, and not the programmers?" And I would argue that this is an ill-placed criticism: it doesn't mean something is "wrong" with either the language or the programmers: instead, it just means that it's a technology that has a learning curve. I also had early awkward periods of low productivity when I first started learning how to touch-type: that doesn't mean that something is wrong with keyboards!
- kenhwang 8y agoI found out that 90% of the time, I'm more at fault than the borrow checker because I'm writing code that would be unsafe should concurrency/parallelism be introduced. But a lot of people don't naturally write or even know how to write concurrency safe code, especially when there's no intention for the code being parallelized.
- sargun 8y agoI'm not arguing the borrow checker is wrong, I'm just saying, rather than being the Star Ship: Enterprise's computer, and asking me to put up shields, I want the language to put up the shields for me. Yes, they might result in a power drain, but 99% of the time, I don't want to get shot, at the expense of power. Just treat things as immutable, and copy them around, or automagically allow for wrapping / unwrapping a (Ref)Cell/(A)rc
- andolanra 8y agoRust is designed to make it easy and safe to build the 1% of your application that cares strongly about resource usage, because for certain application domains (like low-level server software or operating systems) that section might make up more like 10% or even 100% of your application. In those situations, Rust can provide a lot of advantages that a less strict tool might not be able to provide. It sounds to me like the design philosophy that informs Rust is different from the design philosophy you'd prefer, and that's okay! That means Rust might not be a compelling fit for your problems, but not every tool is going to fit every problem domain. That doesn't mean the tool is broken, just that it's designed for a different situation.
- sbjs 8y agoRust seems so low level that I don't get why people flock to it when C# and Java would be much better fits? Is it just because they're bored of C# and Java and want to learn a new language? Even Erlang should scratch that itch! I would guess that only the Servo team really benefits from Rust, or maybe some wall street traders who need hyper speed! Every other app should work fine with something slower.
- steveklabnik 8y agoWe've got a lot of comapanies using Rust for various things that aren't Servo nor Wall Street traders :) https://www.rust-lang.org/en-US/friends.html https://www.rust-lang.org/en-US/friends.html In many cases, C# or Java are great choices for a project, but Rust fits in quite often too.
- sbjs 8y agoWow, big list. I guess more people need the speed Rust gives after all! Would you say the job market is good for Rust? I only sunk my teeth into React and I'm loving it but I'm open minded.
- steveklabnik 8y agoCompared to Java or C#? Miniscule. There are jobs happening, but they're often not pure Rust jobs. It's changing a lot though; there used to be like, two or three at best.
- k__ 8y agoI don't understand why anyone would go for C# or Java. If you want GC and/or fast dev speed, go for JavaScript. If you really need static typing, go for TypeScript. JS has one of the fastest VMs on the planet and virtually everywhere. If you need speed and don't want to mess around with decades of C/C++ legacy quirks, go for Rust.
- sbjs 8y agoI'm with you, I love TypeScript! It's my favorite language of all time! But people using Java and C# are usually tied to a platform and SDK that TypeScript can't easily interoperate with. But I guess if you can replace your whole app with an Electron version, go with TypeScript all the way!!
- sargun 8y agoI also saw (1) be true most of the time. Why isn't Copy / Clone / Immutability the default (pass by value), as opposed to the exception? It seems like if you found this was slow, you could go back and fix things when you need the performance, as opposed to wasting time doing lots of copy / clones (and really ugly code). How does binding all sorts of short-lived variables make your architecture better?