Ruby 2.7.0-rc2 Released

12 months ago - Direct link

We are pleased to announce the release of Ruby 2.7.0-rc2.

A release candidate is released to gather feedback for the final release
planned for December 25.

It also introduces a number of new features and performance improvements,
most notably:


  • Pattern Matching

  • REPL improvement

  • Compaction GC

  • Separation of positional and keyword arguments

Pattern Matching [Experimental]

Pattern matching, a widely used feature in functional programming languages,
is introduced as an experimental feature.
[Feature #14912]

It can traverse a given object and assign its value if it matches a pattern.

require "json"

json = <<END
{
"name": "Alice",
"age": 30,
"children": [{ "name": "Bob", "age": 2 }]
}
END

case JSON.parse(json, symbolize_names: true)
in {name: "Alice", children: [{name: "Bob", age: age}]}
p age #=> 2
...


Go to article →

Links in this thread

Feature #14912: Introduce pattern matching syntax - Ruby master - Ruby Issue Tracking System
Redmine


Pattern matching - New feature in Ruby 2.7
https://rubykaigi.org/2019/presentations/k_tsj.html


Feature #14683: IRB with Ripper - Ruby master - Ruby Issue Tracking System
Redmine


Feature #14787: Show documents when completion - Ruby master - Ruby Issue Tracking System
Redmine


Bug #14918: Use Reline for fallback of ext/readline - Ruby master - Ruby Issue Tracking System
Redmine


Feature #15626: Manual Compaction for MRI's GC (`GC.compact`) - Ruby master - Ruby Issue Tracking System
Redmine


Feature #14183: "Real" keyword argument - Ruby master - Ruby Issue Tracking System
Redmine


Feature #16345: Don't emit deprecation warnings by default. - Ruby master - Ruby Issue Tracking System
Redmine


Feature #16289: Reduce duplicated warnings for the change of Ruby 3 keyword arguments - Ruby master - Ruby Issue Tracking System
Redmine


Feature #12125: Proposal: Shorthand operator for Object#method - Ruby master - Ruby Issue Tracking System
Redmine


Feature #13581: Syntax sugar for method reference - CommonRuby - Ruby Issue Tracking System
Redmine


Feature #16275: Revert `.:` syntax - Ruby master - Ruby Issue Tracking System
Redmine


Feature #4475: default variable name for parameter - Ruby master - Ruby Issue Tracking System
Redmine


Feature #14799: Startless range - Ruby master - Ruby Issue Tracking System
Redmine


Feature #11297: Allow private method of self to be called - Ruby master - Ruby Issue Tracking System
Redmine


Feature #16123: Allow calling a private method with `self.` - Ruby master - Ruby Issue Tracking System
Redmine


Feature #15901: Enumerator::Lazy#eager - Ruby master - Ruby Issue Tracking System
Redmine


Feature #16150: Add a way to request a frozen string from to_s - Ruby master - Ruby Issue Tracking System
Redmine


Optimize CGI.escapeHTML by reducing buffer extension and branches by k0kubun · Pull Request #2226 · ruby/ruby
Benchmark Intel 4.0GHz i7-4790K with 16GB memory under x86-64 Ubuntu 8 Cores, gcc 7.3.0 escape_utils.gem's benchmark Here's the benchmark result of escape_utils/benchmark/html_escape.rb using this CGI.escapeHTML. Originally CGI.escapeHTML was about 0.72x of EscapeUtils.escape_html, and now it's 2.48x. $ bundle exec ruby -v benchmark/html_escape.rb ruby 2.7.0dev (2019-06-05 master 0a29dc8) [x86_64-linux] last_commit=Optimize CGI.escapeHTML by reducing buffer extension Escaping 154483 bytes of html from https://en.wikipedia.org/wiki/Succession_to_the_British_throne Warming up -------------------------------------- Rack::Utils.escape_html 16.000 i/100ms Haml::Helpers.html_escape 616.000 i/100ms ERB::Util.html_escape 626.000 i/100ms CGI.escapeHTML 631.000 i/100ms String#gsub 24.000 i/100ms fast_xs_extra#fast_xs_html 332.000 i/100ms EscapeUtils.escape_html 255.000 i/100ms Calculating ------------------------------------- Rack::Utils.escape_html 166.291 (± 2.4%) i/s - 832.000 in 5.006558s Haml::Helpers.html_escape 6.376k (± 2.7%) i/s - 32.032k in 5.028389s ERB::Util.html_escape 6.366k (± 3.6%) i/s - 31.926k in 5.022500s CGI.escapeHTML 6.386k (± 3.1%) i/s - 32.181k in 5.045185s String#gsub 240.854 (± 1.2%) i/s - 1.224k in 5.082920s fast_xs_extra#fast_xs_html 3.345k (± 1.8%) i/s - 16.932k in 5.064190s EscapeUtils.escape_html 2.572k (± 3.0%) i/s - 13.005k in 5.060726s Comparison: CGI.escapeHTML: 6385.6 i/s Haml::Helpers.html_escape: 6375.6 i/s - same-ish: difference falls within error ERB::Util.html_escape: 6366.2 i/s - same-ish: difference falls within error fast_xs_extra#fast_xs_html: 3344.6 i/s - 1.91x slower EscapeUtils.escape_html: 2572.2 i/s - 2.48x slower String#gsub: 240.9 i/s - 26.51x slower Rack::Utils.escape_html: 166.3 i/s - 38.40x slower Note: Haml::Helpers.html_escape uses ERB::Util.html_escape which uses CGI.escapeHTML, so those 3 are the same. Other scenarios When there's at least one escaped character (_one, _all, _real), it becomes 1.91~5.35x. When there's nothing to be escaped (_blank, _none), unfortunately it becomes 1.08~1.12x slower. $ benchmark-driver benchmark/cgi_escape_html.yml -v --rbenv 'before;after' --repeat-count=8 before: ruby 2.7.0dev (2019-06-05 master f3c877e) [x86_64-linux] after: ruby 2.7.0dev (2019-06-05 master 0a29dc8) [x86_64-linux] last_commit=Optimize CGI.escapeHTML by reducing buffer extension Calculating ------------------------------------- before after escape_html_blank 26.946M 25.011M i/s - 20.000M times in 0.742213s 0.799655s escape_html_short_none 25.898M 23.174M i/s - 20.000M times in 0.772249s 0.863042s escape_html_short_one 8.046M 17.748M i/s - 20.000M times in 2.485578s 1.126892s escape_html_short_all 5.539M 10.561M i/s - 5.000M times in 0.902758s 0.473462s escape_html_long_none 1.373M 1.231M i/s - 1.000M times in 0.728400s 0.812565s escape_html_long_all 1.093M 5.849M i/s - 1.000M times in 0.914765s 0.170957s escape_html_real 1.121M 2.565M i/s - 1.000M times in 0.891941s 0.389921s Comparison: escape_html_blank before: 26946437.8 i/s after: 25010784.2 i/s - 1.08x slower escape_html_short_none before: 25898374.9 i/s after: 23173849.3 i/s - 1.12x slower escape_html_short_one after: 17747937.4 i/s before: 8046417.1 i/s - 2.21x slower escape_html_short_all after: 10560503.5 i/s before: 5538580.2 i/s - 1.91x slower escape_html_long_none before: 1372873.0 i/s after: 1230671.0 i/s - 1.12x slower escape_html_long_all after: 5849414.4 i/s before: 1093177.0 i/s - 5.35x slower escape_html_real after: 2564622.4 i/s before: 1121150.9 i/s - 2.29x slower


Feature #16255: Make `monitor.rb` built-in - Ruby master - Ruby Issue Tracking System
Redmine


rubygems/bundler
Manage your Ruby application's gem dependencies. Contribute to rubygems/bundler development by creating an account on GitHub.


rubygems/rubygems
Library packaging and distribution for Ruby. Contribute to rubygems/rubygems development by creating an account on GitHub.


ruby/csv
CSV Reading and Writing. Contribute to ruby/csv development by creating an account on GitHub.


ruby/rexml
REXML is an XML toolkit for Ruby. Contribute to ruby/rexml development by creating an account on GitHub.


ruby/rss
RSS reading and writing. Contribute to ruby/rss development by creating an account on GitHub.


Feature #15321: Update Unicode data to Unicode Version 12.0.0 - Ruby master - Ruby Issue Tracking System
Redmine


Feature #15195: Deal with new Japanese era - Ruby master - Ruby Issue Tracking System
Redmine


Feature #15742: Add Date#jisx0301 support new Japanese era - Ruby master - Ruby Issue Tracking System
Redmine


Misc #15347: Require C99 - Ruby master - Ruby Issue Tracking System
Redmine


C99 - Ruby master - Ruby Issue Tracking System
Redmine


ruby/ruby
The Ruby Programming Language [mirror]. Contribute to ruby/ruby development by creating an account on GitHub.


https://github.com/ruby/ruby/compare/v2_6_0...v2_7_0_rc2


https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.0-rc2.tar.bz2


https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.0-rc2.tar.gz


https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.0-rc2.tar.xz


https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.0-rc2.zip