2 ms·
Disagree, I have a web server in Actix that I would have written in TypeScript and Node, or Python and Django, or Ruby and Rails, and the Rust version is simila
by satvikpendem 4y ago
Disagree, I have a web server in Actix that I would have written in TypeScript and Node, or Python and Django, or Ruby and Rails, and the Rust version is similarly high level but far faster and more efficient. I recommend people read Zero To Rust In Production if they want to build a web API in Rust.
https://zero2prod.com https://zero2prod.com
- renewiltord 4y agoI had the opposite experience. I wanted a quick http server that would proxy some requests where I couldn't control the client and the real servers. I hadn't written either language at the time, but I had it in seconds in Golang and fully functional and I used actix and halfway through the dependencies disappeared and then afterwards it was still a hassle even with help from people on the subreddit and discord. Reduced to its barebones, the problem is: 1. Expose a HTTP server 2. Make n HTTP requests 3. Combine their output 4. Return the result But I was definitely expecting to have an outcome in a few hours. This might be a language that it takes more than that time for me to be proficient enough to use async code in. Here's an example from my friend, almost exactly my problem and what was suggested: https://old.reddit.com/r/rust/comments/kvnq36/does_anyone_know_how_to_use_an_auxiliary_worker/ https://old.reddit.com/r/rust/comments/kvnq36/does_anyone_kn...
- satvikpendem 4y agoNot sure what you mean by dependencies disappearing. > This might be a language that it takes more than that time for me to be proficient enough to use async code in. Yes, it does take more time to learn the language, but once you do, it's pretty straightforward. Rust is a different way of thinking (a Meta Language dialect in C clothing, as I like to call it; it looks like C but it's definitely not the same semantically) while Go is similar enough to C-based languages and web based languages like Javascript that it's relatively easy to get started with. It's much the same as learning Haskell or APL, the entire paradigm will be different and can't be picked up in a few hours. However, if you already have functional or array programming experience, Haskell and APL will seem straightforward. It is because you have a lot of C-language or JS based experience that Go was easy for you.
- renewiltord 4y agoI'd just started on things and they randomly disappeared the repo. There was some Rust community kerfuffle that was going on. I don't know the details. It was really annoying at that time, but it's really not a big deal now. Yeah, it's probably just the programming paradigm that was different, but if you look at that post I posted there, it's not that straightforward (all the code is there so you can try it out). For what it's worth, I found burntsushi's code wicked easy. I don't write Rust but I have my own forks for `xsv` and `ripgrep` and I could just pop in and add a new command and some functionality. But that actix-web experience was intense. I spent like 4 hours on it and couldn't make it work and then the repo disappeared and I just used go.
- satvikpendem 4y agoOh you must have used it in the Actix Web drama time period in 2020. Yeah it's much better now. You might want to try it again, it's as straightforward as Go now I believe.
- renewiltord 4y agoThanks, I'll give it another whack!
- shepherdjerred 4y ago> the Rust version is similarly high level In typical TypeScript/Python, you don't need to worry about memory allocation. At all. If you're writing any non-trivial Rust application, you're quickly going to have to learn a lot of concepts regarding memory, and your code will reflect that. Now, if your application must be high-performance then Rust is a no-brainer. Rust is much better than the alternative (probably C++). But, most web applications don't need to be high-performance, and it would be better to use a language that is easier to learn and write.
- satvikpendem 4y agoI've been going through this book, not once did I have to think about memory management (beyond adding a few &), it's simply not needed at this high level and crates manage most of the low level details for you. I especially haven't had to think about Arc, Rc, etc either.
- shepherdjerred 4y agoUnfortunately I haven't had the same experience as you. Even for a simple program I've had to think about passing by value/reference, lifetime annotations, static lifetimes, etc. That's not to say I don't like Rust; I hope it takes over the world that C/C++ have a grip on.
- dgb23 4y agoThat's a good book. Project focused and practical. From my limited experience I think it is possible to write simple, dumb Rust, still get a N times performance benefit using N times less resources compared the languages you listed at the cost of being more verbose. There's a learning curve to understanding concepts like lifetimes and so on. But diving deeper there arise many problems. There are just a ton of hyper specific and nuanced types and traits in Rust, and that's just the std lib. Reading Rust is also quite difficult because it takes time to navigate the types and abstractions. Also dependency trees seem to be deep in OS projects. It's a powerful, great language, but I would say the learning curve and the subtleties can _easily_ be underestimated, because there is an initial AHA moment when lifetimes, traits, closures, async etc. start to click. But the devil is in the details. But I think the need/want for safe, fast languages with good security defaults is on a steady rise, especially in web development. Clients (laymen) start to notice and praise good performance and robustness more than they did 10y in my experience, so it's definitely worth it to take a look at languages at Rust.