josefrichter

josefrichter

Ruby 3.0: Actor model and GenServer implementation

I was looking at some news about Ruby 3 (see Ruby 3.0.0 Released | Ruby) and came also across this GenServer implementation which I thought I’d share here:

What do you folks think about Ruby 3? What kind of applications does it open in Ruby world that were previously not feasible? How does it compare to Elixir, what might be the implications, good or bad.

Just to be clear, I am curious about your opinions, not in some pointless Ruby vs Elixir flamewar. I love both Elixir and Ruby and I am pretty sure many people in this forum feel the same.

Most Liked

lucaong

lucaong

I think it’s a great feature that has the potential to bring a solid concurrency pattern to Ruby. I think that it is quite amazing that Ruby adopted the actor model: this has the potential to make Ruby even better than it already was.

Is this making Ruby preferable to Elixir/Erlang for concurrency? Most likely not, because of the issues with mutability mentioned above, and the lack of a VM designed from the beginning for safe concurrency. But I believe that’s not the point: this feature makes Ruby better, and applicable to more problems than it used to be.

I think about this as beneficial “cross-pollination” between languages, not as a competition.

As an engineer that loves both Ruby and Elixir, this feature makes me happy, as it expands the creative space of my favorite tools. If I am designing specifically for concurrency, I will still reach for Elixir. But in a project that fits Ruby better, this makes it possible to introduce concurrency where needed, using a pattern I like.

As for the GenServer implementation, I look at it more as an example to understand how Ractors work, than as a piece of code I would introduce in a real app. It wouldn’t make real sense to port exactly OTP GenServers to Ractors, as the underlying system is different. In Ruby, I would use the actor model idiomatically, without trying to mimic OTP too closely.

subbu

subbu

I haven’t read Ruby 3 feature list yet, but IMO, GenServer gets its power from OTP/BEAM and its ability to run long running processes. You can store arbitrary data in the process and use it however you want. I am not sure actor model is powerful without a VM. What do others think?

egze

egze

Wondering if the start_link even makes sense in Ruby? Does it really link anything?

Last Post!

gregvaughn

gregvaughn

It’s funny how things come together. I don’t know the Ruby 3 feature list, but I learned of an actor framework in Ruby that was strongly influenced by OTP (GitHub - celluloid/celluloid: Actor-based concurrent object framework for Ruby · GitHub) about the same time I heard of Elixir in 2013, and even then, I was more interested in Elixir because it was running on BEAM and could take advantage of its guarantees.

Where Next?

Popular in Discussions Top

rower687
Hi all, I’ve been reading a lot about the “let it crash” term and how supervising processes and the whole messaging passing make an elixi...
New
MarioFlach
Hello, I want to share a project I’ve been working on for a while: https://github.com/almightycouch/gitgud Background Some time ago I ...
New
tmbb
This is a post to discuss the new Phoenix LiveView functionality. From Chris’s talk, it appears that they generate all HTML on the serve...
342 18634 126
New
tomekowal
Hey guys! I want to create a toy project that shows a chart of temperature over time and updates every 5 seconds. I feel LiveView is per...
New
RudManusachi
What configs will make sense to put to runtime.exs? – A bit of how I configure apps: I have generic configs in config/config.exs, dev...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
matthias_toepp
I’d love to hear what people think about Wisp, the new Gleam web framework started by Gleam’s primary creator Louis Pilfold. Gleam, alon...
New

Other popular topics Top

grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54260 488
New
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 49266 226
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New

We're in Beta

About us Mission Statement