4 ms·
I did C/C++ for years 10+ years ago, but since learning Ruby and then Elixir I've loved the functional approach. I've thought a lot about rust over the years b
by freedomben 4y ago
I did C/C++ for years 10+ years ago, but since learning Ruby and then Elixir I've loved the functional approach. I've thought a lot about rust over the years but I haven't yet found a project where it made more sense than Ruby or Elixir did given the learning effort. I've done a few projects in Go and while I like it's simplicity, I dislike the verbosity and lack of functional features.
Does anybody else have a similar background that can share their opinion/love level of rust?
Rust people: do you use Rust for (nearly) everything? i.e. does it feel very general purpose, or if you are doing something that will be entirely network I/O bound anyway do you reach for something else?
- mcronce 4y agoI came from PHP, Python, and Go (in that order) with very limited experience in both C and C++ and now use Rust for everything with one exception - a scraper for mint.com that uses https://github.com/mintapi/mintapi https://github.com/mintapi/mintapi. That has a lot going on, including spinning up a headless browser, and my code is virtually trivial, so the benefits of porting it to Rust are limited, and the work would be pretty significant. As far as things I typically make, database-backed HTTP APIs are probably the most common, and influxdb collectors second most common.
- freedomben 4y agoThanks! Is there a specific rust framework you would recommend for HTTP APIs? Or is the standard lib good enough that you don't really need one?
- mcronce 4y agoI always use actix-web. warp comes pretty highly recommended as well, although I haven't personally tried it.
- quake 4y agoI can probably chime in here. I have used Rust professionally for 2 years but I've been working with it as a hobby for 3. Experience predominantly in C/C++ embedded and systems environments. I've used Rust for *nix based IOT programs to ingest data from different sources (network I/O, serial, CAN, files, etc), as well as for bare-metal embedded development. I've also made some dinky webservers as an exercise and various random tooling. It's a very, very flexible language, once you get over its quirks. I found myself using it to make tools that I would usually turn to Python for. I'm quite impressed with how "high level" the language feels despite being able to work with low-level concepts. Simple stuff like mapping iterators and the Option<T> type while working without an OS is a fantastic feeling. As most people will likely say, take Rust for a test drive with a basic project to decide for yourself. I would say to keep it simple and not go down the async route as your first foray, though.
- ReadEvalPost 4y agoDo you have any recommendations on libraries for parsing CAN with Rust (or are your tools OSS)? I'll be working on a project in a couple of months that'll need to pull data off CAN.
- fiedzia 4y ago> do you use Rust for (nearly) everything? Nearly. There are still some things easier to do in Python or JS, but the gap is closing quickly and I'm fine with spending small amount of convenience to get quality of Rust code. I am looking now into having nearly 100% Rust frontend + Rust backend for some simple project and it does look promising.
- rapsey 4y ago> I did C/C++ for years 10+ years ago, but since learning Ruby and then Elixir I've loved the functional approach. Not Elixir but I spend 10 years in Erlang before moving to Rust and prefer to never go back. A statically typed language is just better. No matter how easy Erlang/Elixir makes some things. I do not at all miss needing to refactor my code and being scared of all the crashes that inevitably result. I do not at all miss seeing crashes that only show up under production load.
- freedomben 4y agoThanks, that is pretty helpful since Erlang and Elixir are so similar in philosophy. How long did it take you to get to the point with Rust where you wouldn't want to back? Do you use any sort of actor implementation in Rust?
- rapsey 4y agoWell I had a major project for which Rust was the only logical choice. I very quickly found Rust to just be very enjoyable to use. So even if something is in the Eralng/Elixir wheelhouse I would still prefer Rust. I do not use an actor framework. It is best to use whatever is standard for the language. For Rust this is Tokio async ecosystem.
- SevenNation 4y agoThe most surprising thing about Rust is how high-level it feels compared to other "systems" languages. Unless the problem space demands something other than Rust, I don't see much reason to choose anything else. And this includes projects where Ruby, Python, and JavaScript were used.
- deleted 4y ago[deleted]
- lalaithion 4y agoIt's very general purpose. I feel like I could do anything in it. However, I still do numerical stuff and one-off scripts in Python, just due to lack of friction and not needing correctness/performance, and for bigger projects where being I/O bound is the main issue – I still use Rust, but I do wish there was an alternative which was "Rust but with a garbage collector". Haskell and the ML family are fine but they just don't have the same number of high-quality libraries with the well thought out modern stdlib of Rust as a base. Elixir/Erlang/Lisps are fine but I'd really like strong, static types. Gleam/Pony are too niche. I'd like to like Scala but every time I try I run into something inscrutable and demonic, and the Java ecosystem is comprehensive but (in my opinion) super annoying.
- LinXitoW 4y agoDamn do I with there was Rust with GC. Rust has so many wonderful high level features I'm missing even in "hip" languages (compare error handling with Kotlin), but I don't really care that much about the systems programming parts.
- pizza234 4y ago> Does anybody else have a similar background that can share their opinion/love level of rust? I come from higher level language(s). But I find hard to program without functional composition as well. > Rust people: do you use Rust for (nearly) everything? i.e. does it feel very general purpose, or if you are doing something that will be entirely network I/O bound anyway do you reach for something else? General purpose language != efficient for all the use cases. I do a considerable amount of hobby programming in Rust, but I think it's a niche language. I think it's vastly most efficient to use other language in the very large majority of the use cases - there are plenty of modern languages the are good enough and don't have such a high overhead (ie. manual memory management). Nonetheless I've found that with a couple of years of experience (likely less than half, if programming professionally), developing with Rust is considerably simpler than one would imagine.
- marcus_cemes 4y agoI've done some C/C++, a lot of JS/TS due to its web dominance. I found Elixir a year ago and fell in love with it. I love the functional style of Elixir, it's elegant to write and read, but feels unsafe. The lack of a type system is hard for me and has been a nightmare when trying to find the origin of a particular error tuple and refactoring code, running the app to see if it works. Running it in production feels like a ticking time bomb, even if it does handle fault tolerance gracefully. I've reached for Rust for the occasional project and have never regretted it, I couldn't justify its use for everything though. Very high-quality ecosystem, rock solid and predictable performance and tiny footprint. I've made a VPN supervisor process that fits in a few MB Docker image (without OS), uses a few MB of RAM, no idle CPU and wonderful latency. Perhaps Erlang can manage tail latencies better under load, pre-emptive scheduling is awesome, but my personal experience has been that Rust is just much more efficient at doing the same task, giving you more free CPU time, predictable memory freeing that rivals Erlang's per-process GC. You finish that blocking computation before it even becomes noticeable. Erlang’s fault tolerance is matched by Rust’s type system and memory safety guarantees. It's hard to compare C++/Rust to Erlang/Python/Ruby, they're just different. It's slower and more frustrating to write, but the language server gives you so much feedback and useful comments. I find the linter amazing, it finds some pretty obscure and neat improvements with the additional type information it has, and Option<T> and Result<T,E> have an almost functional-like chaining pattern. For a small hobby project, Rust 100% of the time. No painful dependency management, no complex build process. For a more serious project, or for a client, not always justifiable. I always miss Rust’s language features and libraries when coding in another language that has the upper hand in their respective dominant fields, although I like that a lot of tooling (ESBuild, swc, Tailwind's compiler, fnm, Rome, ...) is being remade in Go/Rust, it benefits far more people than it inconveniences.