4 ms·
> isn’t JavaScript a bit more of a higher level language Rust has zero-cost abstractions that feel like using Ruby and a rich type system that makes it incredi
by echelon 6y ago
> isn’t JavaScript a bit more of a higher level language
Rust has zero-cost abstractions that feel like using Ruby and a rich type system that makes it incredibly expressive. Working in other languages feels like going back to assembly.
I wouldn't want to design state machines in any other language. Rust's enums make it feel smooth as butter. They're a killer app. (The whole ecosystem is. Cargo. Package naming. Traits. So much good stuff.)
Rust is my most productive language now, and I work in Python, Java, and Typescript codebases frequently.
Edit: I'm being downvoted for expressing preference? What's with all the Rust hate? Learn it instead of being a hater. It's a wonderful tool, and it's silly to dismiss because you think people are being hipsters or something. There's a reason people love it.
- shpongled 6y agoI'm a big Rust fan too. I have experience in all of the languages you've mentioned, and I'm most productive in Rust as well. It's funny you mention enums, there was just another thread last week where I brought up how crazy it is that sum types (Rust enums) and pattern matching have been around since the 70s but have largely been limited to the FP languages. After extensively using Rust for ~3 years now, I don't ever want to use a language without sum types - you can write incredibly expressive and concise code with them. The other major productivity boost for me is the ability to compose and chain Iterators and mix those with collection types.
- hombre_fatal 6y agoPeople often demand generics in Go. But I think that actual sum types would be a bigger boon (if I got to choose). You can basically avoid interface{} in generic Go code with some copy and paste. But you can't really avoid it when you're trying to write code that would be cleaned up by an actual sum type. Not to commit the predicable sin of comparing Rust to Go any time either is brought up. I just mean to +1 the idea that sum types should actually be a fundamental tool that we can reach for in every language. So weird that it's taking so long to go mainstream, so to speak.
- eloff 6y agoI just implemented an iterator in rust yesterday. After having done it in c++ back in the day, I was blown away by how easy and powerful it is.
- hombre_fatal 6y agoWhen you're writing synchronous, single-threaded code like, say, a binary file parser or even an HTML scraper with blocking APIs, Rust is 1:1 with high level languages, and usually better. Where Rust diverges is when you're doing async or multithreaded things with complicate lifetimes. Getting things right from the start instead of solving them JIT as runtime issues pop up in production over the course of the year is Rust's wheelhouse. But even after using Rust for three years, I sometimes feel like I'm one requirement-change away from a problem I can't solve myself in Rust where I could solve it in a couple hours in another language.
- zozbot234 6y ago> But even after using Rust for three years, I sometimes feel like I'm one requirement-change away from a problem I can't solve myself in Rust where I could solve it in a couple hours in another language. Rust does have these sorts of issues wrt. managing highly generic graph-like data, possibly with cycles. That's where tracing GC actually shines, and where writing that whole portion separately in something like Go might be the right answer.
- jfkebwjsbx 6y agoReference-counted graphs are usually quite fine.
- hombre_fatal 6y agoYep. When I'm writing Go, I spend the whole time yearning for the abstractions of Rust, becoming a little more bitter each time I copy and paste or have to manually reify interface{}, knowing my ceremonious verbose Go code is slower than the simpler compact Rust solution. When I'm writing Rust, I'm loving life until I hit this sort of "intractable" [for me] problem, and I wonder if I should have used Go for this part.
- steveklabnik 6y agoThat is true if you have to write your own. 99.99% of the time, if you need a graph, you use petgraph and move on with life.
- Scarbutt 6y agoI have seen this being asked many times in /r/rust and 90% of the answers disagree with you. A common theme is to explore in Python then rewrite in Rust.
- nightowl_games 6y agogamedev here and I basically do exactly this. explore in GDScript, rewrite in cpp. (GDScript is pretty much python)
- zenhack 6y agoI think a lot of the best the best things in Rust don't really have anything to do with low level programming per-se. And I find that for most applications, even with all of the extra goodness, the lack of a GC totally craters productivity. Its not because I'm fighting the borrow checker -- I got the hang of it pretty quick. But it means that every API is complicated by the need to think about lifetimes and ownership, having to think about different types of smart pointer, etc. It means you have to manage all of these silly little details which for most applications are pretty irrelevant. This isn't a criticism of Rust; it's specifically designed for applications where those things do matter. But for the overwhelming majority of apps they don't, and I'd reach for a different tool. I've found that once I get into a rhythm and I've been working on something in Rust for a bit, it doesn't feel that hard to deal with all that. And a few times I've thought to myself "hey maybe the GC isn't actually buying you all that much?" But then I go back to a GC'd language and watch just how much faster stuff gets done. It's not even close. I think it's one of these things where your brain doesn't notice the time that goes by when you're doing what is essentially mindless busywork. Part of this is also having come from doing a fair bit of stuff in Haskell, Elm, and a bit of OCaml; the best "high-level" language features are inspired by that language family (including enums) and so it feels like a better control for the difference a GC makes vs. js and friends. It makes a big difference.
- blub 6y agoWhat's puzzling is why a language designed for memory safety and low-level control and performance is even being considered for web development where they had the former all along and they generally don't care about the latter. Or if they do they use Java, Go or throw a couple dozen more servers at the problem.
- entha_saava 6y agoWith all the "Rust is as productive as X" and "If your data structure/logic won't work in rust, it was bad design" bullshit the silent majority of us are accustomed to see on HN..
- imtringued 6y ago
- blub 6y agoThere's the hype and there's the reality. Some people don't appreciate the former much and reach for the down arrow... Rust is nowhere near the productivity of Ruby or Python. If that's the case for you maybe your projects have some peculiarities or it's a personal thing.
- jfkebwjsbx 6y agoYou are probably being downvoted because of this sentence: > Working in other languages feels like going back to assembly This is not a preference, it is an exaggeration and an attack on all other languages. It is also quite ironic given Rust is intended for low level programming.
- entha_saava 6y ago> and it's silly to dismiss because you think people are being hipsters or something. Ah yes. If you think rust is bad, you are bad and you should feel bad. If your business logic requires little interlinked data structures or something else that rust doesn't allow, your business logic itself is at fault, your business is at fault, YOU are at fault, and you should verify your life integrity with algebraic data type in rust. Rust is more productive than Go or Python or Java or anything because if crab god yells at you you must have wrong design and you don't have any taste and you are std::real::life::programmer::stupid and you should #[feel(stupid)].