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?

Where Next?

Popular in Discussions Top

AstonJ
I’ve just started the Phoenix part of the utterly brilliant online course by @pragdave. On generating the Phoenix app he uses the --no-ec...
New
andre1sk
A big advantage to Elixir is all the distributed goodness but for many applications running on multiple nodes having integrated Etcd, Zoo...
New
pillaiindu
In django there is a cache framework backed by memcached. Rails also puts a lot of emphasis on caching, and even the idea of russian-doll...
New
WildYorkies
It seems that the more I read, the more I find Elixir users speaking about all the ways that Elixir is not good for x, y, and z use cases...
New
chuck
Let me start by stating an assumption: Phoenix is a great approach to building REST APIs. There are many reasons for this, but I will ass...
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
opsb
We’re considering our architecture from a viewpoint of scaling our traffic heavily over the next 6 months. Our current deployment is runn...
New
owaisqayum
I have a sample string sentence = "Hello, world ... 123 *** ^%&*())^% %%:>" From this string, I want to only keep the integers, ...
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
fireproofsocks
I’ve been working on an Elixir project that has required a lot of scripting. I usually reach for Elixir because I like it more (and in th...
New

Other popular topics Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
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
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39297 209
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

We're in Beta

About us Mission Statement