DEV Community

loading...

Discussion on: All I Want For Christmas Is Ruby 3

Collapse
thorstenhirsch profile image
Thorsten Hirsch

Hey guys, great article, just one thing that made me wonder:

r1, r2 = *(1..2).map do
...
Enter fullscreen mode Exit fullscreen mode

I'm pretty sure you don't need the * in front of the sequence, because map returns an array. So this works as well:

r1, r2 = (1..2).map do
...
Enter fullscreen mode Exit fullscreen mode

The * is required when we want to splat sequences:

r1, r2 = *(1..2)
Enter fullscreen mode Exit fullscreen mode
Collapse
bengreenberg profile image
Ben Greenberg Author

Hey Thorsten, thanks for commenting! The code snippet for the Ractor section is mentioned as coming from the Ruby release notes not from me. :) Instead of reinventing the wheel I just shared theirs. The link to the original is in the post, too: ruby-lang.org/en/news/2020/09/25/r...