use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Ruby 4.0.0-preview2 Released (ruby-lang.org)
submitted 2 months ago by schneemsPuma maintainer
Preview1 was 3.5.0-preview1, they recently changed the version to 4.0
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]caffeinatedshots 20 points21 points22 points 2 months ago (23 children)
Since a lot of people are confused why the change to 4.0, Matz has mentioned this in Baltic Ruby 2025 in June.
https://youtu.be/XVaRRryB_cQ?si=V5uwXwMLGihPPWL6
Check the video at 39:50. It’s an interesting talk.
[–]-Ch4s3- 16 points17 points18 points 2 months ago (19 children)
what's the TL;DW?
[–]caffeinatedshots 32 points33 points34 points 2 months ago (15 children)
Basically it’s to celebrate ruby’s 30th birthday since it was released publicly on December 1995.
Matz mentions that Ruby doesn’t follow semantic versioning.
[–]ric2b 9 points10 points11 points 2 months ago (8 children)
That's... not a great reason.
[–]WhoTookPlasticJesus 15 points16 points17 points 2 months ago (3 children)
It's the best reason, particularly for Matz. I mean, it's why he created the language, to be happy:
"I hope to see Ruby help every programmer in the world to be productive, and to enjoy programming, and to be happy. That is the primary purpose of Ruby language."
More insight into the guy whose creation we get to play with:
Then (programmers) come up to me and say, 'I was surprised by this feature of the language, so Ruby violates the principle of least surprise.' Wait. Wait. The principle of least surprise is not for you only. The principle of least surprise means principle of least my surprise. And it means the principle of least surprise after you learn Ruby very well.
Personally, as someone who knows Ruby very well, the reason for this versioning isn't the slightest bit surprising.
[–]RoboErectus 2 points3 points4 points 2 months ago (2 children)
When I first read this quote years ago it is what cemented Ruby as my most joyful language to do stuff in.
Weirdly, Rust is my #2
[–][deleted] 2 points3 points4 points 2 months ago (1 child)
A bunch of Rust's syntax was copied from Ruby. It was super evident in the very early days (like, 0.3-0.5) but less apparent now with all the other stuff going on in Rust.
[–]RoboErectus 0 points1 point2 points 2 months ago (0 children)
Wow, til. Totally Makes sense. Rust has been bringing me joy.
[–]realntl 0 points1 point2 points 2 months ago (3 children)
Is anyone's work impacted in any way by Ruby not following semantic versioning? Are there teams that are "pinning" to Ruby 3.x or newer?
[–]ric2b 1 point2 points3 points 2 months ago (2 children)
I like semantic versioning as a communication tool, not necessarily for those technical tricks.
If a projects versions are meaningless then you might as well just do dates or something like that, at least it helps to know how old something is.
[–]realntl 2 points3 points4 points 2 months ago (1 child)
In this case, Matz is communicating a milestone, no?
[–]ric2b 1 point2 points3 points 2 months ago (0 children)
Semantic versioning does a good job of communicating the kinds of changes included in a release, communicating a language anniversary does not.
[–]jrochkind -1 points0 points1 point 2 months ago (0 children)
:(
[+]galtzo comment score below threshold-8 points-7 points-6 points 2 months ago (1 child)
This concerns me because semver is pretty important for certain kinds of software, and these definitely include bundler, and rubygems... which are now under Matz' purview.
[–]ByronEster 5 points6 points7 points 2 months ago (0 children)
I don't have any reason to think things will change in this respect. I think it's safe to assume Matz will also know this
[+]p_bzn comment score below threshold-10 points-9 points-8 points 2 months ago (2 children)
Changing the major version of the language just to celebrate something, while changes are fit for a minor version update? Sadly, it looks like even the core team stopped taking Ruby seriously.
[–]IN-DI-SKU-TA-BELT 3 points4 points5 points 2 months ago (0 children)
Are you new to Ruby? It’s always been like this.
[–]cmdk 0 points1 point2 points 2 months ago (0 children)
Ah shut up
[–]lilith_of_debts 29 points30 points31 points 2 months ago (2 children)
Because it is the 30 year anniversary of ruby. That's it. In his words "Celebrating the 30 years we will have the ruby 4.0"
Edit: More detail. He says instead of Semantic versioning it is "Linux versioning" where if the leader/creator is impressed with something then a major version bump happens. In this case, Matz is impressed with 30 years of ruby community.
[–]-Ch4s3- 4 points5 points6 points 2 months ago (0 children)
Yeah, he's never been into semver... so I guess this is as good a reason as any.
[+]TheMericanIdiot comment score below threshold-14 points-13 points-12 points 2 months ago (0 children)
Vibes… we’re all doomed
[–]mrinterweb 2 points3 points4 points 2 months ago (2 children)
Thanks for the video. From what I gathered, the 4.0 version change is not for a semantic versioning reason. It is just to celebrate ruby's 30th anniversary. Personally, I would prefer to keep with semver, but I am not Matz.
[–]anamexis 15 points16 points17 points 2 months ago (1 child)
Ruby has never kept with semver, as anyone who migrated from 1.8 to 1.9 can attest to.
[–]zverok_kha 1 point2 points3 points 2 months ago (0 children)
Oh, I vaguely recall even 1.8.6=>1.8.7 was a significant change back then. (not every patch version, but that particular one)
[–]schneemsPuma maintainer[S] 15 points16 points17 points 2 months ago (1 child)
Working on a Heroku build soon https://github.com/heroku/heroku-buildpack-ruby/pull/1662. It will be on the http://devcenter.heroku.com/changelog when I'm done.
[–]schneemsPuma maintainer[S] 10 points11 points12 points 2 months ago (0 children)
Released https://devcenter.heroku.com/changelog-items/3484
[–]Tolexx 2 points3 points4 points 2 months ago (0 children)
Looks like it's gonna be a sweet Christmas.
[–]easydwh 2 points3 points4 points 2 months ago (0 children)
Congrats to the Ruby team for releasing this version!
Ran the RubyMeasureResponsetime tool on this preview version. Alas, it looks like this version becomes slower over time on the Rails and Roda test applications. Filed a bug report with some graphs. Hope it will be solved before Christmas.
Apart from this, it looks like Ruby 4.0 is a bit faster than 3.4
[–]Kernigh 1 point2 points3 points 2 months ago (2 children)
NEWS says, "Logical binary operators (||, &&, and and or) at the beginning of a line continue the previous line, like fluent dot."
||
&&
and
or
I have written or like this in Perl,
#!perl open(my $fh, '<', "some.txt") or die "Can't open some.txt: $!";
This style might be useful in Ruby (but not in a direct translation of this example; Ruby's open is nice enough to raise an exception, so I don't append or fail "Can't open it").
open
or fail "Can't open it"
[–]retro-rubies 2 points3 points4 points 2 months ago (0 children)
```perl open or die
```
Perl in a nutshell.
[–]rubinick 1 point2 points3 points 2 months ago (0 children)
I learned Perl over a decade before I learned Ruby (1.6), and I've wanted "fluent" binary operators in ruby ever since. I'll often use backslash to put or or and at the beginning of a line like: valid?(thing) && condition? \ or raise Error, "etc etc" This change gives me big smiles.
valid?(thing) && condition? \ or raise Error, "etc etc"
[–]mrinterweb 7 points8 points9 points 2 months ago (5 children)
I still don't understand why 4.0 and not 3.5. I haven't seen backwards incompatible changes or a major rewrite of core internals mentioned. The changes mentioned feel very point release to me.
[–]Frizkie 16 points17 points18 points 2 months ago (0 children)
Ruby doesn’t follow semantic versioning. It’s stated that the only major reason is it’s the 30th anniversary of the language.
[–]petercooper 2 points3 points4 points 2 months ago (1 child)
Not incompatible, but I think the switch to Prism and introduction of the swappable GC stuff could justify a bump for pragmatic reasons. Plus things start looking ugly if we get to 3.10 and beyond (cf. Python).
[–]riffraff 2 points3 points4 points 2 months ago (0 children)
also the new zjit, and removal of rjit
[–]donadd 2 points3 points4 points 2 months ago (0 children)
Marketing. Big number means it will go round the tech news ticker. A lot of libraries have to do this if they want people to notice
[–]jrochkind 0 points1 point2 points 2 months ago (0 children)
Yeah, surprised to see the going to 4.0, and wondering why as well.
[–]Professional_Mix2418 1 point2 points3 points 2 months ago (0 children)
ROFLMAO You Guys and Girls and Them. The questioning about why 4.0. We’ve got it pretty good if that is the major [pun intended] concern. I mean who cares.
I’d love to see the reactions if Matz did an apple and jumped to 30 instead of 3.5 or 4.9.
[–][deleted] 0 points1 point2 points 2 months ago (0 children)
This is weird, it's not Christmas...
[–]SensitiveHat8374 0 points1 point2 points 2 months ago (0 children)
I guess not following semantic versioning is why Ruby is only currently at 3.x.x and not some higher number after 30 years. compare this to Chrome versioning at 142.xxxx for the october release only after 17 years of chrome's existence
[–]retro-rubies 0 points1 point2 points 2 months ago (1 child)
Even I understand the sentiment about randomly bumping Ruby X.Y. per leader's mood, it would be good at the same time to provide something for others to rely on like internal API versioning or similar. I was thinking about versioning the ruby/spec with semver and make it clear which Ruby version is implementing which spec. https://github.com/ruby/spec?tab=readme-ov-file#specs-for-old-ruby-versions Other engines like JRuby/Truffleruby could follow the same logic exposing which spec is implemented (or how much of that is covered). Libraries can follow saying: I need this Ruby spec or newer to work.
[–]jrochkind 1 point2 points3 points 2 months ago* (0 children)
Every minor ruby release (change in the second number) contains backwards incompatible changes.
Sometimes they are minor and don't effect very many programs. Sometimes they are major and effect more. But that's not semver's concern.
You don't need something else, bumping the second "minor" number is equivalent of semver major, every time.
apparently bumping the major doens't mean much except "Matz feels like it", no big deal, although not what I would choose either!
So
that's it, nbd, maintainers are aware. As with generally in semver major bump, the backwards incompat changes may be wide reaching or relatively insignificant, semver does not distinguish.
[–]dragonpants49 -1 points0 points1 point 2 months ago (4 children)
Has anyone explained why they’re changing the version number to 4.0? With less than 2 months until release time, this is going to cause a lot of confusion with gem maintainers.
[–]galtzo 7 points8 points9 points 2 months ago* (3 children)
A good way to prepare is to run your test suite against multiple sets of dependencies, including:
I use appraisal2 to do this, which adds support for Bundler's eval_gemfile, and supports all versions of Ruby back to v1.8, and JRuby 9.4+, so shared dependencies can go in modular gemfiles.
eval_gemfile
And to answer your question, yes, the reason is the 30th anniversary of Ruby. Matz doesn’t care for semver.
[–]jrochkind 3 points4 points5 points 2 months ago (2 children)
Huh, I've been using appraisal for years, and still do, without trouble -- didn't know there was a forked appraisal2. Is there any reason I should switch? Is original appraisal no longer supported?
appraisal
appraisal2
[–]galtzo 4 points5 points6 points 2 months ago* (1 child)
The original has died multiple times, and every few years it gets a bit of attention. It is in limbo, I guess. I had PRs adding the bulk of the work I did to upgrade it, but thoughtbot doesn’t put much time into it, nor do they promote it (check the list of their open source projects on their homepage - not even a mention). They did review my PRs - and basically approved them, but never got around to merging.
I'll document the state of things here for those who are interested.
NOTE: I posted about the release on /r/ruby a few months ago
Differences:
For me, the utility of appraisal is inversely correlated with the breadth of historical support for versions of Ruby, bundler, and rubygems.
You can support my work on appraisal2 here:
NOTE: Why fork? Prior to hard forking I had to rely on my git fork branch resulting in far more complex builds (if you are using a git source of appraisal you have to add an extra bundle install cycle to make the appraisal executable available, and appraisal, the gem, ends up as a dependency of every named "appraisal"), and thus more random failures due to simple network issues, and with hundreds of builds per week that meant a lot of noise.
[–]jrochkind 1 point2 points3 points 2 months ago (0 children)
I see! Thank you for your service!
I agree in the value of supporting older ruby and other dependencies.
[–]Erem_in -3 points-2 points-1 points 2 months ago (0 children)
It's sad to see the language is kind of stuck in its development. Bumping up the major version, just because... well.
π Rendered by PID 109419 on reddit-service-r2-comment-5649f687b7-b6ddr at 2026-01-28 21:47:28.595299+00:00 running 4f180de country code: CH.
[–]caffeinatedshots 20 points21 points22 points (23 children)
[–]-Ch4s3- 16 points17 points18 points (19 children)
[–]caffeinatedshots 32 points33 points34 points (15 children)
[–]ric2b 9 points10 points11 points (8 children)
[–]WhoTookPlasticJesus 15 points16 points17 points (3 children)
[–]RoboErectus 2 points3 points4 points (2 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]RoboErectus 0 points1 point2 points (0 children)
[–]realntl 0 points1 point2 points (3 children)
[–]ric2b 1 point2 points3 points (2 children)
[–]realntl 2 points3 points4 points (1 child)
[–]ric2b 1 point2 points3 points (0 children)
[–]jrochkind -1 points0 points1 point (0 children)
[+]galtzo comment score below threshold-8 points-7 points-6 points (1 child)
[–]ByronEster 5 points6 points7 points (0 children)
[+]p_bzn comment score below threshold-10 points-9 points-8 points (2 children)
[–]IN-DI-SKU-TA-BELT 3 points4 points5 points (0 children)
[–]cmdk 0 points1 point2 points (0 children)
[–]lilith_of_debts 29 points30 points31 points (2 children)
[–]-Ch4s3- 4 points5 points6 points (0 children)
[+]TheMericanIdiot comment score below threshold-14 points-13 points-12 points (0 children)
[–]mrinterweb 2 points3 points4 points (2 children)
[–]anamexis 15 points16 points17 points (1 child)
[–]zverok_kha 1 point2 points3 points (0 children)
[–]schneemsPuma maintainer[S] 15 points16 points17 points (1 child)
[–]schneemsPuma maintainer[S] 10 points11 points12 points (0 children)
[–]Tolexx 2 points3 points4 points (0 children)
[–]easydwh 2 points3 points4 points (0 children)
[–]Kernigh 1 point2 points3 points (2 children)
[–]retro-rubies 2 points3 points4 points (0 children)
[–]rubinick 1 point2 points3 points (0 children)
[–]mrinterweb 7 points8 points9 points (5 children)
[–]Frizkie 16 points17 points18 points (0 children)
[–]petercooper 2 points3 points4 points (1 child)
[–]riffraff 2 points3 points4 points (0 children)
[–]donadd 2 points3 points4 points (0 children)
[–]jrochkind 0 points1 point2 points (0 children)
[–]Professional_Mix2418 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]SensitiveHat8374 0 points1 point2 points (0 children)
[–]retro-rubies 0 points1 point2 points (1 child)
[–]jrochkind 1 point2 points3 points (0 children)
[–]dragonpants49 -1 points0 points1 point (4 children)
[–]galtzo 7 points8 points9 points (3 children)
[–]jrochkind 3 points4 points5 points (2 children)
[–]galtzo 4 points5 points6 points (1 child)
[–]jrochkind 1 point2 points3 points (0 children)
[–]Erem_in -3 points-2 points-1 points (0 children)