New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ruby 2.7 Support #6464
Comments
Looks like a great start on this checklist, thank you. I think some of these were nested items but didn't convert to markdown that way. Can you double-check the structure so we can be sure this checklist is easy to read? |
Rails 7.0 requires Ruby 2.7 or higeher. CI pending the following matrix until JRuby 9.4 that supports Ruby 2.7 will be released. jruby/jruby#6464
Will JRuby 9.4 target Ruby 2.7 or Ruby 3.0? |
There is no checklist yet for 3.0 features, but that would be a good step for us to take. |
@eregon I noticed you created oracle/truffleruby#2453 today with a 3.0 checklist. Since I am not a contributor, I can't access the raw markdown (seems weird, but ok), but it is basically the same format we have used for our past checklists. Could you copy it into a JRuby issue or post that markdown somewhere? |
@eregon Nevermind, I figured out a way to get the raw markdown (quote reply). |
I think you can also copy it from ruby/spec#823 where you have write permissions. |
Issue for Ruby 3.0 support is #6878 |
GC.compact is added but does nothing (we do not have that level of control over JVM GCs). |
The optimized Array#minmax and Range#minmax would be pretty easy Java tasks for someone. They could be pure-Ruby, but that would not really gain us much over just using Enumerable#minmax. Array#minmax is described in https://bugs.ruby-lang.org/issues/15929 Range#minmax is described in https://bugs.ruby-lang.org/issues/15807 |
Comparable#clamp is there but does not appear to support endless or beginless ranges. |
Range#minmax (already implemented) jruby/core/src/main/java/org/jruby/RubyRange.java Line 1055 in 8030ff9
Array#minmax #6939 |
This commit makes the following test pass. * test_produce in test/mri/ruby/test_enumerator.rb * spec/ruby/core/enumerator/produce_spec.rb For jruby#6464
This commit makes the following tests pass. * test_produce in test/mri/ruby/test_enumerator.rb * spec/ruby/core/enumerator/produce_spec.rb For jruby#6464
To create an Enumerator instance with size, this implementation uses __from method insted of Enumerator.new . And this commit makes the following tests pass. * spec/ruby/core/enumerator/lazy/eager_spec.rb For jruby#6464
Updated based on current master. |
I think we can call this one done. The implementation improvements might be interesting for the performance work planned in 9.5, but we have implemented basically everything else in this list! |
Extra information : the latest version of Nokogiri (1.14.0) requires "Ruby >= 2.7.0". Given the number of security issues on Nokogiri, this is one extra motivation to move forward! |
Ruby 2.7 Support
This issue will track Ruby 2.7 support for JRuby 9.4
This checklist is based on MRI's NEWS file: https://github.com/ruby/ruby/blob/ruby_2_7/NEWS
I removed the clear C API related issues, but there should still be a few.
Changes since the 2.6.0 release
Language changes
Pattern matching
Pattern matching is introduced as an experimental feature. [Feature
#14912]
See the following slides for more details:
ot-7
The warning against pattern matching can be suppressed with
-W:no-experimental option. (Add support for -W:category flag #7436)
The spec of keyword arguments is changed towards 3.0
Automatic conversion of keyword arguments and positional arguments is
deprecated, and conversion will be removed in Ruby 3. [Feature #14183]
When a method call passes a Hash at the last argument, and when it
passes no keywords, and when the called method accepts keywords, a
warning is emitted. To continue treating the hash as keywords, add a
double splat operator to avoid the warning and ensure correct behavior
in Ruby 3.
When a method call passes keywords to a method that accepts keywords,
but it does not pass enough required positional arguments, the
keywords are treated as a final required positional argument, and a
warning is emitted. Pass the argument as a hash instead of keywords
to avoid the warning and ensure correct behavior in Ruby 3.
When a method accepts specific keywords but not a keyword splat, and a
hash or keywords splat is passed to the method that includes both
Symbol and non-Symbol keys, the hash will continue to be split, and a
warning will be emitted. You will need to update the calling code to
pass separate hashes to ensure correct behavior in Ruby 3.
If a method does not accept keywords, and is called with keywords, the
keywords are still treated as a positional hash, with no warning. This
behavior will continue to work in Ruby 3.
Non-symbols are allowed as keyword argument keys if the method accepts
arbitrary keywords. [Feature #14183]
Non-Symbol keys in a keyword arguments hash were prohibited in 2.6.0,
but are now allowed again. [Bug #15658]
**nil
is allowed in method definitions to explicitly mark that themethod accepts no keywords. Calling such a method with keywords will
result in an ArgumentError. [Feature #14183]
Passing an empty keyword splat to a method that does not accept keywords
no longer passes an empty hash, unless the empty hash is necessary for a
required parameter, in which case a warning will be emitted. Remove the
double splat to continue passing a positional hash. [Feature #14183]
Above warnings can be suppressed also with -W:no-deprecated
option. (Add support for -W:category flag #7436)
Numbered parameters
Numbered parameters as default block parameters are introduced.
[Feature Activating refinements in binding.eval doesn't stick outside of the evaluated string. #4475]
[1, 2, 10].map { _1.to_s(16) } #=> ["1", "2", "a"]
[[1, 2], [3, 4]].map { _1 + _2 } #=> [3, 7]
You can still define a local variable named
_1
and so on, and that ishonored when present, but renders a warning.
proc/lambda without block is deprecated
Proc.new and Kernel#proc with no block in a method called with a block is
warned now.
This warning can be suppressed with -W:no-deprecated
option.
Kernel#lambda with no block in a method called with a block raises an
exception.
Other miscellaneous changes
A beginless range is experimentally introduced. It might be useful in
case
, new call-sequence of theComparable#clamp
, constants and DSLs.[Feature #14799]
Setting
$;
to a non-nil value is warned now. [Feature #14240] Use of itin String#split is warned too. This warning can be suppressed with
-W:no-deprecated option.
Setting
$,
to a non-nil value is warned now. [Feature #14240] Use of itin Array#join is warned too. This warning can be suppressed with
-W:no-deprecated option.
Quoted here-document identifiers must end within the same line.
The flip-flop syntax deprecation is reverted. [Feature Time.new with explicit timezone string will display as UTF with +00:00. #5400]
Comment lines can be placed between fluent dot now.
Calling a private method with a literal
self
as the receiver is nowallowed. [Feature #11297] [Feature #16123]
Modifier rescue now operates the same for multiple assignment as single
assignment. [Bug #8279]
yield
in singleton class syntax is warned and will be deprecated later.[Feature #15575].
This warning can be suppressed with -W:no-deprecated
option.
Argument forwarding by
(...)
is introduced. [Feature #16253]All arguments to
foo
are forwarded tobar
, including keyword and blockarguments. Note that the parentheses are mandatory.
bar ...
is parsedas an endless range.
Access and setting of
$SAFE
is now always warned.$SAFE
will become anormal global variable in Ruby 3.0. [Feature #16131]
Object#{taint,untaint,trust,untrust}
and related functions in the C-APIno longer have an effect (all objects are always considered untainted),
and are now warned in verbose mode. This warning will be disabled even in
non-verbose mode in Ruby 3.0, and the methods and C functions will be
removed in Ruby 3.2. [Feature #16131]
Refinements take place at Object#method and Module#instance_method.
[Feature #15373]
Command line options
Warning option
The
-W
option has been extended with a following:
, to manage categorizedwarnings. [Feature #16345] [Feature #16420] (#7436)
To suppress deprecation warnings:
It works with the
RUBYOPT
environment variable:To suppress experimental feature warnings:
To suppress both by using
RUBYOPT
, set space separated values:See also Warning in [Core classes updates]
Core classes updates (outstanding ones only)
Added Array#intersection. [Feature #16155]
Added Array#minmax, with a faster implementation than
Enumerable#minmax. Bug #15929, add Array#minmax #6939
Comparable#clamp now accepts a Range argument. [Feature #14784]
Added Complex#<=>. So
0 <=> 0i
will not raise NoMethodError.[Bug #15857]
Dir.glob and Dir.[] no longer allow NUL-separated glob pattern.
Use Array instead. [Feature #14643]
Added new encoding CESU-8. [Feature #15931]
Added Enumerable#filter_map. [Feature #15323]
Added Enumerable#tally. [Feature #11076]
Added Enumerator.produce to generate an Enumerator from any custom
data transformation. [Feature #14781]
Added Enumerator::Lazy#eager that generates a non-lazy enumerator
from a lazy enumerator. [Feature #15901]
Added Enumerator::Yielder#to_proc so that a Yielder object can be
directly passed to another method as a block argument. [Feature
#15618]
Added Fiber#raise that behaves like Fiber#resume but raises an
exception on the resumed fiber. [Feature #10344]
File.extname now returns a dot string for names ending with a dot
on non-Windows platforms. [Bug #15267]
Added FrozenError#receiver to return the frozen object on which
modification was attempted. To set this object when raising
FrozenError in Ruby code, FrozenError.new accepts a
:receiver
option. [Feature #15751]
Added GC.compact method for compacting the heap. This function
compacts live objects in the heap so that fewer pages may be used,
and the heap may be more CoW (copy-on-write) friendly. [Feature
#15626]
Added IO#set_encoding_by_bom to check the BOM and set the external
encoding. [Bug #15210]
Integer#[] now supports range operations. [Feature #8842]
Method#inspect shows more information. [Feature #14145]
Added Module#const_source_location to retrieve the location where
a constant is defined. [Feature #10771]
Added Module#ruby2_keywords for marking a method as passing
keyword arguments through a regular argument splat, useful when
delegating all arguments to another method in a way that can be
backwards compatible with older Ruby versions. [Bug #16154]
Module#autoload? now takes an
inherit
optional argument, likeModule#const_defined?. [Feature #15777]
Module#name now always returns a frozen String. The returned
String is always the same for a given Module. This change is
experimental. [Feature #16150]
NilClass#to_s, TrueClass#to_s, and FalseClass#to_s now always
return a frozen String. The returned String is always the same for
each of these values. This change is experimental. [Feature
#16150]
ObjectSpace::WeakMap#[]= now accepts special objects as either key
or values. [Feature #16035]
Added Proc#ruby2_keywords for marking the proc as passing keyword
arguments through a regular argument splat, useful when delegating
all arguments to another method or proc in a way that can be
backwards compatible with older Ruby versions. [Feature #16404]
Added Range#minmax, with a faster implementation than
Enumerable#minmax. It returns a maximum that now corresponds to
Range#max. Bug #15807
Range#=== now uses Range#cover? for String arguments, too (in Ruby
2.6, it was changed from Range#include? for all types except
strings). [Bug #15449]
RubyVM.resolve_feature_path
moved to$LOAD_PATH.resolve_feature_path
. [Feature #15903] [Feature#15230]
Update Unicode version and Emoji version from 11.0.0 to 12.0.0.
[Feature #15321]
Update Unicode version to 12.1.0, adding support for U+32FF SQUARE
ERA NAME REIWA. [Feature #15195]
Update Unicode Emoji version to 12.1. [Feature #16272]
Added Symbol#start_with? and Symbol#end_with? methods. [Feature
#16348]
Added Time#ceil method. [Feature #15772]
Added Time#floor method. [Feature #15653]
Time#inspect is separated from Time#to_s and it shows the time's
sub second. [Feature #15958]
Added UnboundMethod#bind_call method. [Feature #15955]
Added Warning.[] and Warning.[]= to manage emitting/suppressing
some categories of warnings. [Feature #16345] [Feature #16420]
Added
$LOAD_PATH.resolve_feature_path
. [Feature #15903][Feature #15230]
Stdlib updates (outstanding ones only)
Bundler
https://github.com/bundler/bundler/releases/tag/v2.1.2
CGI
character. See Optimize CGI.escapeHTML by reducing buffer extension and branches ruby/ruby#2226
CSV
Date
era. [Feature #15742]
Delegator
context of the returned class, similar to Class.new and Struct.new.
ERB
IRB
Introduce syntax highlighting inspired by the Pry gem to Binding#irb
source lines, REPL input, and inspect output of some core-class
objects.
Introduce multiline editing mode provided by Reline.
Show documentation when completion.
Enable auto indent and save/load history by default.
JSON
Net::FTP
to enable/disable each of them. [Feature #15964]
Net::HTTP
ipaddr
optional parameter to Net::HTTP#start to replace theaddress for the TCP/IP connection. [Feature [ji] RubyString implements CharSequence #5180]
Net::IMAP
open-uri
Warn open-uri's "open" method at Kernel. Use URI.open instead. [Misc
#15893]
The default charset of "text/*" media type is UTF-8 instead of
ISO-8859-1. [Bug #15933]
OptionParser
Now show "Did you mean?" for unknown options. [Feature #16256]
Pathname
base
keyword. [Feature #14405]
Racc
Reline
implemented in pure Ruby. It also provides a multiline editing mode.
Rexml
RSS
RubyGems
StringScanner
Compatibility issues (excluding feature bug fixes)
The following libraries are no longer bundled gems. Install corresponding
gems to use these features.
Proc
Range
now uses the same algorithm as Range#max. In rare cases (e.g. ranges
of Floats or Strings), this may yield different results. [Bug #15807]
Stdlib compatibility issues (excluding feature bug fixes)
See #7015 for a complete listing of gemified stdlib in 9.4 and current status.
Promote stdlib to default gems
The following default gems were published on rubygems.org
The following default gems were only promoted at ruby-core, but not
yet published on rubygems.org.
The
did_you_mean
gem has been promoted up to a default gem from abundled gem
pathname
argument instead of creating a new Pathname. This is more similar to
other Kernel methods, but can break code that modifies the return
value and expects the argument not to be modified.
profile.rb
Implementation improvements
Allow selecting different coroutine implementations by using
--with-coroutine=
, e.g.Replace previous stack cache with fiber pool cache. The fiber pool
allocates many stacks in a single memory region. Stack allocation
becomes O(log N) and fiber creation is amortized O(1). Around 10x
performance improvement was measured in micro-benchmarks.
Improve performance of fiber creation by using pool allocation strategy. ruby/ruby#2224
File.realpath now uses realpath(3) on many platforms, which can
significantly improve performance. [Feature #15797]
Change data structure of small Hash objects. [Feature #15602]
Monitor class is written in C-extension. [Feature #16255]
VM stack memory allocation is now combined with native thread stack,
improving thread allocation performance and reducing allocation
related failures. Around 10x performance improvement was measured in
micro-benchmarks.
JIT-ed code is recompiled to less-optimized code when an optimization
assumption is invalidated.
Method inlining is performed when a method is considered as pure. This
optimization is still experimental and many methods are NOT considered
as pure yet.
The default value of
--jit-max-cache
is changed from 1,000 to 100.The default value of
--jit-min-calls
is changed from 5 to 10,000.Per-call-site method cache, which has been there since around 1.9, was
improved: cache hit rate raised from 89% to 94%. See
reduce cache mishits ruby/ruby#2583
Some methods are defined in *.rb (such as trace_point.rb). For example, it
is easy to define a method which accepts keyword arguments.
The text was updated successfully, but these errors were encountered: