зеркало из https://github.com/github/ruby.git
250 строки
7.1 KiB
Plaintext
250 строки
7.1 KiB
Plaintext
# -*- rdoc -*-
|
|
|
|
= NEWS for Ruby 2.6.0
|
|
|
|
This document is a list of user visible feature changes made between
|
|
releases except for bug fixes.
|
|
|
|
Note that each entry is kept so brief that no reason behind or
|
|
reference information is supplied with. For a full list of changes
|
|
with all sufficient information, see the ChangeLog file or Redmine
|
|
(e.g. <tt>https://bugs.ruby-lang.org/issues/$FEATURE_OR_BUG_NUMBER</tt>)
|
|
|
|
== Changes since the 2.5.0 release
|
|
|
|
=== Language changes
|
|
|
|
* $SAFE is a process global state and we can set 0 again. [Feature #14250]
|
|
|
|
* refinements take place at block passing. [Feature #14223]
|
|
|
|
* `else` without `rescue` now causes a syntax error. [EXPERIMENTAL]
|
|
|
|
* constant names may start with a non-ASCII capital letter. [Feature #13770]
|
|
|
|
* An endless range is introduced. You can write a range that has no end, like `(0..)`.
|
|
The following shows typical use cases. [Feature #12912]
|
|
|
|
ary[1..] # identical to ary[1..-1]
|
|
(1..).each {|index| ... } # infinite loop from index 1
|
|
ary.zip(1..) {|elem, index| ... } # ary.each.with_index(1) { }
|
|
|
|
=== Core classes updates (outstanding ones only)
|
|
|
|
* Array
|
|
|
|
* Aliased methods:
|
|
|
|
* Array#filter is a new alias for Array#select [Feature #13784]
|
|
* Array#filter! is a new alias for Array#select! [Feature #13784]
|
|
|
|
* Binding
|
|
|
|
* New methods:
|
|
|
|
* added Binding#source_location. [Feature #14230]
|
|
|
|
This method returns the source location of binding, a 2-element
|
|
array of `__FILE__` and `__LINE__`. Traditionally, the same
|
|
information could be retrieved by `eval("[__FILE__, __LINE__]",
|
|
binding)`, but we are planning to change this behavior so that
|
|
`Kernel#eval` ignores binding's source location [Bug #4352].
|
|
So, users should use this newly-introduced method instead of
|
|
`Kernel#eval`.
|
|
|
|
* Dir
|
|
|
|
* New methods:
|
|
|
|
* added Dir#each_child and Dir#children instance methods. [Feature #13969]
|
|
|
|
* Enumerable
|
|
|
|
* Aliased methods:
|
|
|
|
* Enumerable#filter is a new alias for Enumerable#select [Feature #13784]
|
|
|
|
* Enumerator::Lazy
|
|
|
|
* Aliased methods:
|
|
|
|
* Enumerator::Lazy#filter is a new alias for Enumerator::Lazy#select [Feature #13784]
|
|
|
|
* Exception
|
|
|
|
* Exception#full_message takes :highlight and :order options [Bug #14324]
|
|
|
|
* Hash
|
|
|
|
* Aliased methods:
|
|
|
|
* Hash#filter is a new alias for Hash#select [Feature #13784]
|
|
* Hash#filter! is a new alias for Hash#select! [Feature #13784]
|
|
|
|
* Kernel
|
|
|
|
* Kernel.#Complex takes :exception option to specify the way of error handling [Feature #12732]
|
|
|
|
* Kernel.#Float takes :exception option to specify the way of error handling [Feature #12732]
|
|
|
|
* Kernel.#Integer takes :exception option to specify the way of error handling [Feature #12732]
|
|
|
|
* Kernel.#Rational takes :exception option to specify the way of error handling [Feature #12732]
|
|
|
|
* Kernel.#system takes :exception option to raise an exception on
|
|
failure. [Feature #14386]
|
|
|
|
* KeyError
|
|
|
|
* KeyError#initialize accepts :receiver and :key options to set receiver and key in Ruby code. [Feature #14313]
|
|
|
|
* NameError
|
|
|
|
* NameError#initialize accepts :receiver option to set receiver in Ruby code. [Feature #14313]
|
|
|
|
* NoMethodError
|
|
|
|
* NoMethodError#initialize accepts :receiver option to set receiver in Ruby code. [Feature #14313]
|
|
|
|
* Proc
|
|
|
|
* Proc#call doesn't change $SAFE any more. [Feature #14250]
|
|
|
|
* Random
|
|
|
|
* New methods:
|
|
|
|
* added Random.bytes. [Feature #4938]
|
|
|
|
* Range
|
|
|
|
* Range#=== now uses #cover? instead of #include? method. [Feature #14575]
|
|
|
|
* String
|
|
|
|
* String#split yields each substring to the block if given. [Feature #4780]
|
|
|
|
=== Stdlib updates (outstanding ones only)
|
|
|
|
* ERB
|
|
|
|
* Add :trim_mode and :eoutvar keyword arguments to ERB.new. Now non-keyword arguments other than first one
|
|
are softly deprecated and will be removed when Ruby 2.5 becomes EOL. [Feature #14256]
|
|
|
|
* erb command's -S option is deprecated, which will be removed in the next version.
|
|
|
|
* FileUtils
|
|
|
|
* New method:
|
|
|
|
* FileUtils#cp_lr [Feature #4189]
|
|
|
|
* Matrix
|
|
|
|
* New method:
|
|
|
|
* Matrix#antisymmetric?
|
|
|
|
* REXML
|
|
|
|
* Improved some XPath implementations:
|
|
|
|
* concat() function: Stringify all arguments before concatenating
|
|
|
|
* string() function: Support context node
|
|
|
|
* string() function: Support processing instruction node
|
|
|
|
* Support "*:#{ELEMENT_NAME}" syntax in XPath 2.0
|
|
|
|
* Fixed some XPath implementations:
|
|
|
|
* "//#{ELEMENT_NAME}[#{POSITION}]" case
|
|
|
|
* string() function: Fix function(document) returns nodes that are
|
|
out of root elements.
|
|
|
|
* "/ #{ELEMENT_NAME} " case
|
|
|
|
* "/ #{ELEMENT_NAME} [ #{PREDICATE} ]" case
|
|
|
|
* "/ #{AXIS}:: #{ELEMENT_NAME} " case
|
|
|
|
* "#{N}-#{M}" case: One ore more white spaces were required before "-"
|
|
|
|
* "/child::node()" case
|
|
|
|
* "#{FUNCTION}()/#{PATH}" case
|
|
|
|
* "@#{ATTRIBUTE}/parent::" case
|
|
|
|
* "name(#{NODE_SET})" case
|
|
|
|
* RSS
|
|
|
|
* RSS::Parser.parse: Accept options as Hash. :validate,
|
|
:ignore_unknown_element, :parser_class options are available.
|
|
|
|
* Set
|
|
|
|
* Aliased methods:
|
|
|
|
* Set#filter! is a new alias for Set#select! [Feature #13784]
|
|
|
|
* URI
|
|
|
|
* Add URI::File to handle file URI scheme [Feature #14035]
|
|
|
|
=== Compatibility issues (excluding feature bug fixes)
|
|
|
|
* File
|
|
|
|
* File.read, File.binread, File.write, File.binwrite, File.foreach,
|
|
and File.readlines do not invoke external commands even if the path
|
|
starts with the pipe character |. [Feature #14245]
|
|
|
|
* Dir
|
|
|
|
* Dir.glob with '\0'-separated pattern list will be deprecated, and
|
|
is now warned. [Feature #14643]
|
|
|
|
=== Stdlib compatibility issues (excluding feature bug fixes)
|
|
|
|
=== C API updates
|
|
|
|
=== Supported platform changes
|
|
|
|
=== Implementation improvements
|
|
|
|
* Speedup `Proc#call` because we don't need to care about `$SAFE` any more. [Feature #14318]
|
|
With `lc_fizzbuzz` benchmark which uses so many `Proc#call` we can measure
|
|
x1.4 improvements [Bug #10212].
|
|
|
|
* Speedup `block.call` where `block` is passed block parameter. [Feature #14330]
|
|
Ruby 2.5 improves block passing performance. [Feature #14045]
|
|
Additionally, Ruby 2.6 improves the performance of passed block calling.
|
|
|
|
* Introduce an initial implementation of JIT (Just-in-time) compiler. [Feature #14235] [experimental]
|
|
* `--jit` option is added to enable JIT. `--jit-verbose=1` is good for inspection. See `ruby --help` for others.
|
|
* This JIT relies on C compiler used to build Ruby, on runtime. Only gcc and clang are supported for the JIT
|
|
for now, and MinGW support has some issues.
|
|
* As of 2.6.0-preview1, we're just preparing infrastructure for JIT and very few optimizations are implemented.
|
|
So it's not ready for benchmarking Ruby's JIT performance yet. It's known that current JIT enablement makes
|
|
Rails application slower for now.
|
|
|
|
* VM generator script renewal; makes the generated VM more optimized. [GH-1779]
|
|
|
|
=== Miscellaneous changes
|
|
|
|
* On macOS, shared libraries no longer include a full version number of ruby in their names.
|
|
This eliminates the burden of each teeny upgrade on the platform that users need to rebuild every extension library.
|
|
|
|
* Before:
|
|
* libruby.2.6.0.dylib
|
|
* libruby.2.6.dylib -> libruby.2.6.0.dylib
|
|
* libruby.dylib -> libruby.2.6.0.dylib
|
|
|
|
* After:
|
|
* libruby.2.6.dylib
|
|
* libruby.dylib -> libruby.2.6.dylib
|