4 ms·
As someone who writes Erlang for a living, I highly recommend rust as a well typed alternative to Erlang, that still keeps all of the things that make Erlang gr
by ilovecaching 8y ago
As someone who writes Erlang for a living, I highly recommend rust as a well typed alternative to Erlang, that still keeps all of the things that make Erlang great. I do love Erlang, but working on a large codebase can be frustrating when nothing is speced or commented, and even when it is speced it’s usually part of a gradually typed codebase with very non descriptive types.
- RussianCow 8y agoCould you elaborate on why you find Rust to be an alternative to Erlang? For me at least, most of the draw of Erlang has nothing to do with the language, and everything to do with BEAM/OTP and the surrounding architecture, which (as far as I'm aware) Rust does not provide an alternative to in any shape or form.
- ilovecaching 8y agoSo Rust does not include built in abstractions/frameworks for building distributed systems, but I count that as a good thing. OTP can scale well under certain conditions. But it can also require rewriting supervision, servers, and other core pieces of OTP, which is a huge pain. BIFs can be slow or have wonky behavior, NIFs are dangerous but necessary when Erlang is too slow. When a language gives you prebuilt abstractions it can be a really good thing if they're the abstractions you need, and really bad if your requirements don't line up well, or you're coloring outside the lines in terms of scale or design. It can also be painful to introspect the BEAM to collect metrics and understand message queue pressure on a node. I'm so glad I get to work on Erlang rather than many of the other toolkits that are out there for building big distributed backend systems, but if I was going to start over again it were my choice I would choose Rust and build the right abstractions, the right protocols, and have total control over my system to make tailored performance trade-offs, and do it in a type safe environment, or I would use a third party distributed systems library like bifrost if my project was small. When I said all the things that make Erlang great, I mean pattern matching, FP, a focus on safety and reliability, and a really knowledgeable community. I'm kind of over BEAM/OTP at this point, but that's just my opinion, for the projects I'm working on.
- mledu 8y agoCouldn't you use Erlang/OTP for the main parts of the system and for the performance critical parts that Erlang isn't great for (like crunching numbers) you can use something like Rustler to be build a safer NIF? https://github.com/hansihe/rustler https://github.com/hansihe/rustler
- ilovecaching 8y agoInteresting! I haven't seen this, but it looks really exciting. I may have to bring this up at work!
- RussianCow 8y agoIt sounds like you just don't like BEAM/OTP, then. :) I don't know if I would make a sweeping recommendation for Rust as an alternative to Erlang based on that, though, as I would imagine it would take a TON of work to replicate OTP in Rust.
- ilovecaching 8y agoI guess I'm just looking partly for something different. I've been doing Erlang for a few years now, and it's just the devil I know. :) I think Rust could really take off with more support, but I think Erlang will always be niche. I'd rather see people write more Rust.
- wende 8y agoSame feeling here. I used to work in Erlang on daily basis - now Elixir. And although I'm not a big fan of its syntax (Erlang looks more readable to me) the tooling and the amount of love from Elixir's community is immense I've never had a chance to play with Rust yet. I'll definitely give it a shot someday In my opinion, the best example of how typed languages make it more manageable is Elchemy's codebase itself - which is written in Elm and compile itself. The type system saves us from a huge amount of runtime errors and allows us to sleep at night after a recent release. Most of the time when something goes wrong it's about the parts written in bash or Elixir
- eterps 8y agoI've never had a chance to play with Rust yet. I'll definitely give it a shot someday The comparison of Rust with Elm and F# in this article really clicked for me: https://www.chriskrycho.com/2018/exploring-4-languages-starting-to-model-the-domain.html https://www.chriskrycho.com/2018/exploring-4-languages-start... I always thought of Rust as similar to Go, but now I think more of it like an ML descendant with C'ish syntax. There's more to it though, Rust is more low-level than languages in the ML family and can often provide the same abstractions without hight costs in performance.
- noncoml 8y agoCan you recommend a good web framework/micro-framework? I was using actix-web, but last I heard it has to many unnecessary `unsafe`s.[0] [0] https://www.reddit.com/r/rust/comments/8s7gei/unsafe_rust_in_actixweb_other_libraries/ https://www.reddit.com/r/rust/comments/8s7gei/unsafe_rust_in...
- towerbabbel 8y agoFor a Rust web framework I would recommend rouille.[0] Mature, stable and zero unsafe. [0] https://github.com/tomaka/rouille https://github.com/tomaka/rouille
- steveklabnik 8y agoThe author is responding and taking care of many of them. I’m confident this is a temporary issue, or at least it seems like it’s going correctly to me.
- noncoml 8y agoOh, cool. Good to know
- plainOldText 8y agoRocket is fast and high quality. I’ve gotten impressive latency numbers in my benchmarks. http://rocket.rs/ http://rocket.rs/
- snappyTertle 8y agoWhat about OTP?
- wende 8y agoIt's the first big library that we'll be porting after coming up with a final version of the effects system