2015-12-24 12:25:26 -05:00
|
|
|
# -*- rdoc -*-
|
|
|
|
|
|
|
|
= NEWS for Ruby 2.4.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.3.0 release
|
|
|
|
|
|
|
|
=== Language changes
|
|
|
|
|
2016-04-13 01:36:26 -04:00
|
|
|
* Multiple assignment in conditional expression is now allowed.
|
|
|
|
[Feature #10617]
|
|
|
|
|
2015-12-24 12:25:26 -05:00
|
|
|
=== Core classes updates (outstanding ones only)
|
|
|
|
|
2016-03-17 08:49:19 -04:00
|
|
|
* Array
|
2016-04-14 21:17:51 -04:00
|
|
|
|
2016-03-17 08:49:19 -04:00
|
|
|
* Array#max and Array#min. [Feature #12172]
|
|
|
|
This may cause a tiny incompatibility: if you redefine
|
|
|
|
Enumerable#max and call max to an Array, your redefinition will be
|
|
|
|
now ignored. You should also redefine Array#max.
|
|
|
|
|
2016-04-13 10:55:18 -04:00
|
|
|
* Array#sum [Feature #12217]
|
2016-05-17 23:21:53 -04:00
|
|
|
This is different from Enumerable#sum in that Array#sum doesn't depend on
|
|
|
|
the definition of each method.
|
2016-04-13 10:55:18 -04:00
|
|
|
|
2016-08-11 03:24:25 -04:00
|
|
|
* Comparable
|
|
|
|
|
|
|
|
* Comparable#clamp. [Feature #10594]
|
|
|
|
|
2016-02-16 03:34:47 -05:00
|
|
|
* Dir
|
|
|
|
|
2016-02-16 07:25:54 -05:00
|
|
|
* Dir.empty?. [Feature #10121]
|
2016-02-16 03:34:47 -05:00
|
|
|
|
2016-05-17 23:21:53 -04:00
|
|
|
* Enumerable
|
|
|
|
|
|
|
|
* Enumerable#sum [Feature #12217]
|
2016-07-20 17:00:30 -04:00
|
|
|
* Enumerable#uniq [Feature #11090]
|
|
|
|
|
|
|
|
* Enumerator::Lazy
|
|
|
|
|
|
|
|
* Enumerator::Lazy#uniq [Feature #11090]
|
2016-05-17 23:21:53 -04:00
|
|
|
|
2016-04-13 02:14:12 -04:00
|
|
|
* File
|
|
|
|
|
|
|
|
* File.empty?. [Feature #9969]
|
|
|
|
|
2016-04-14 21:17:51 -04:00
|
|
|
* Float
|
|
|
|
|
2016-04-17 23:56:33 -04:00
|
|
|
* Float#ceil, Float#floor, and Float#truncate now take an optional
|
|
|
|
digits, as well as Float#round. [Feature #12245]
|
2016-04-14 21:17:51 -04:00
|
|
|
|
2016-09-07 22:34:54 -04:00
|
|
|
* Hash
|
|
|
|
|
|
|
|
* Hash#transform_values and Hash#transform_values! [Feature #12512]
|
|
|
|
|
2016-04-14 21:17:51 -04:00
|
|
|
* Integer
|
|
|
|
|
2016-04-17 23:55:33 -04:00
|
|
|
* Integer#ceil, Integer#floor, and Integer#truncate now take an optional
|
|
|
|
digits, as well as Integer#round. [Feature #12245]
|
2016-04-14 21:17:51 -04:00
|
|
|
|
2016-05-17 09:24:53 -04:00
|
|
|
* Fixnum and Bignum are unified into Integer [Feature #12005]
|
|
|
|
|
2016-06-13 21:20:07 -04:00
|
|
|
* Integer#digits for extracting columns of place-value notation [Feature #12447]
|
|
|
|
|
2016-08-03 04:20:13 -04:00
|
|
|
* Kernel
|
|
|
|
|
|
|
|
* Kernel#clone now takes an optional keyword argument, freeze flag.
|
|
|
|
[Feature #12300]
|
|
|
|
|
2016-08-30 08:40:55 -04:00
|
|
|
* MatchData
|
|
|
|
|
|
|
|
* MatchData#named_captures [Feature #11999]
|
|
|
|
* MatchData#values_at supports named captures [Feature #9179]
|
|
|
|
|
2016-09-11 08:33:46 -04:00
|
|
|
* Module
|
|
|
|
|
|
|
|
* Module.used_modules [Feature #7418]
|
|
|
|
|
2016-05-18 06:37:13 -04:00
|
|
|
* Regexp
|
|
|
|
|
|
|
|
* Regexp#match? [Feature #8110]
|
|
|
|
This returns bool and doesn't save backref.
|
|
|
|
|
2016-09-09 00:14:55 -04:00
|
|
|
* Regexp/String: Updated Unicode version from 8.0.0 to 9.0.0 [Feature #12513]
|
|
|
|
|
2016-07-28 15:13:26 -04:00
|
|
|
* RubyVM::Env
|
|
|
|
|
|
|
|
* RubyVM::Env was removed.
|
|
|
|
|
2016-02-16 22:21:35 -05:00
|
|
|
* String
|
|
|
|
|
2016-06-05 06:06:42 -04:00
|
|
|
* String#upcase, String#downcase, String#capitalize, String#swapcase and
|
|
|
|
their bang variants work for all of Unicode, and are no longer limited
|
2016-07-29 23:13:28 -04:00
|
|
|
to ASCII. Supported encodings are UTF-8, UTF-16BE/LE, UTF-32BE/LE, and
|
|
|
|
ISO-8859-1~16. Variations are available with options. See the documentation
|
2016-06-05 06:06:42 -04:00
|
|
|
of String#downcase for details. [Feature #10085]
|
|
|
|
|
2016-02-16 22:21:35 -05:00
|
|
|
* String.new(capacity: size) [Feature #12024]
|
|
|
|
|
2016-02-20 23:52:04 -05:00
|
|
|
* Symbol
|
|
|
|
|
|
|
|
* Symbol#match now returns MatchData. [Bug #11991]
|
|
|
|
|
2016-06-05 06:06:42 -04:00
|
|
|
* Symbol#upcase, Symbol#downcase, Symbol#capitalize, and Symbol#swapcase now
|
|
|
|
work for all of Unicode. See the documentation of String#downcase
|
|
|
|
for details. [Feature #10085]
|
|
|
|
|
2016-06-05 20:25:38 -04:00
|
|
|
* Thread
|
|
|
|
|
|
|
|
* Thread#report_on_exception and Thread.report_on_exception
|
|
|
|
[Feature #6647]
|
|
|
|
|
2015-12-24 12:25:26 -05:00
|
|
|
=== Stdlib updates (outstanding ones only)
|
|
|
|
|
2016-09-26 23:17:47 -04:00
|
|
|
* CGI
|
|
|
|
|
|
|
|
* Don't allow , as a separator [Bug #12791]
|
|
|
|
|
2016-01-01 08:02:56 -05:00
|
|
|
* CSV
|
2016-04-14 21:17:51 -04:00
|
|
|
|
2016-01-01 08:02:56 -05:00
|
|
|
* Add a liberal_parsing option. [Feature #11839]
|
|
|
|
|
2016-04-18 23:55:13 -04:00
|
|
|
* Logger
|
|
|
|
|
|
|
|
* Allow specifying logger parameters in constructor such
|
|
|
|
as level, progname, datetime_format, formatter. [Feature #12224]
|
|
|
|
* Add shift_period_suffix option. [Feature #10772]
|
|
|
|
|
2016-08-29 01:47:09 -04:00
|
|
|
* OpenSSL
|
|
|
|
|
|
|
|
* OpenSSL is extracted as a gem and the upstream has been migrated to
|
|
|
|
https://github.com/ruby/openssl. OpenSSL still remains as a default gem.
|
|
|
|
Refer to its History.md for the full release note. [Feature #9612]
|
|
|
|
|
2016-08-30 08:40:55 -04:00
|
|
|
* optparse
|
|
|
|
|
|
|
|
* Add an into option. [Feature #11191]
|
|
|
|
|
2016-09-26 23:17:47 -04:00
|
|
|
* WEBrick
|
|
|
|
|
|
|
|
* Don't allow , as a separator [Bug #12791]
|
|
|
|
|
2016-04-15 11:26:48 -04:00
|
|
|
=== Compatibility issues (excluding feature bug fixes)
|
|
|
|
|
2016-05-17 23:21:53 -04:00
|
|
|
* Array#sum and Enumerable#sum are implemented. [Feature #12217]
|
2016-05-17 09:26:24 -04:00
|
|
|
Ruby itself has no compatibility problem because Ruby didn't have sum method
|
|
|
|
for arrays before Ruby 2.4.
|
2016-04-15 11:26:48 -04:00
|
|
|
However many third party gems, activesupport, facets, simple_stats, etc,
|
|
|
|
defines sum method. These implementations are mostly compatible but
|
|
|
|
there are subtle differences.
|
|
|
|
Ruby's sum method should be mostly compatible but it is impossible to
|
|
|
|
be perfectly compatible with all of them.
|
2015-12-24 12:25:26 -05:00
|
|
|
|
2016-05-17 09:24:53 -04:00
|
|
|
* Fixnum and Bignum are unified into Integer [Feature #12005]
|
|
|
|
Fixnum class and Bignum class is removed.
|
|
|
|
Integer class is changed from abstract class to concrete class.
|
|
|
|
For example, 0 is an instance of Integer: 0.class returns Integer.
|
|
|
|
The constants Fixnum and Bignum is bound to Integer.
|
|
|
|
So obj.kind_of?(Fixnum) works as obj.kind_of?(Integer).
|
2016-06-20 03:35:05 -04:00
|
|
|
At C-level, Fixnum object and Bignum object should be distinguished by
|
|
|
|
FIXNUM_P(obj) and RB_TYPE_P(obj, T_BIGNUM).
|
2016-09-20 07:12:38 -04:00
|
|
|
RUBY_INTEGER_UNIFICATION can be used to detect this feature at C-level.
|
|
|
|
0.class == Integer can be used to detect this feature at Ruby-level.
|
2016-06-20 03:35:05 -04:00
|
|
|
ruby-2.4.0-preview1 (temporally) removes rb_cFixnum and rb_cBignum
|
|
|
|
to check the effect of incompatibility.
|
|
|
|
(rb_cFixnum and rb_cBignum may be defined as rb_cInteger later if
|
|
|
|
compilation failure of extension library is too big problem.)
|
2016-05-17 09:24:53 -04:00
|
|
|
|
2016-06-05 06:06:42 -04:00
|
|
|
* String/Symbol#upcase/downcase/swapcase/capitalize(!) now work for all of
|
|
|
|
Unicode, not only for ASCII. [Feature #10085]
|
|
|
|
No change is needed if the data is in ASCII anyway or if the limitation
|
|
|
|
to ASCII was only tolerated while waiting for a more extensive implementation.
|
|
|
|
A change (using the :ascii option) is needed in cases where Unicode data
|
|
|
|
is processed, but the operation has to be limited to ASCII only.
|
|
|
|
A good example of this are internationalized domain names.
|
|
|
|
|
2016-04-23 00:23:29 -04:00
|
|
|
=== Stdlib compatibility issues (excluding feature bug fixes)
|
|
|
|
|
|
|
|
* DateTime
|
|
|
|
|
|
|
|
* DateTime#to_time now preserves timezone. [Bug #12189]
|
|
|
|
|
2016-08-30 08:40:55 -04:00
|
|
|
* Time
|
|
|
|
|
|
|
|
* Time#to_time now preserves timezone. [Bug #12271]
|
|
|
|
|
2016-04-29 22:56:17 -04:00
|
|
|
* thread
|
|
|
|
|
|
|
|
* the extension library is removed. Till 2.0 it was a pure ruby script
|
|
|
|
"thread.rb", which has precedence over "thread.so", and has been provided
|
|
|
|
in $LOADED_FEATURES since 2.1.
|
|
|
|
|
2016-08-09 02:44:45 -04:00
|
|
|
* Tk
|
|
|
|
* Tk is removed from stdlib. [Feature #8539]
|
|
|
|
https://github.com/ruby/tk is the new upstream.
|
|
|
|
|
2015-12-24 12:25:26 -05:00
|
|
|
=== C API updates
|
|
|
|
|
2016-01-06 21:34:33 -05:00
|
|
|
* ruby_show_version() will no longer exits the process, if
|
|
|
|
RUBY_SHOW_COPYRIGHT_TO_DIE is set to 0. This will be the default in
|
|
|
|
the future.
|
|
|
|
|
2015-12-24 12:25:26 -05:00
|
|
|
=== Supported platform changes
|
|
|
|
|
2016-05-12 19:46:43 -04:00
|
|
|
* FreeBSD < 4 is no longer supported
|
|
|
|
|
2015-12-24 12:25:26 -05:00
|
|
|
=== Implementation improvements
|
2016-03-17 08:49:19 -04:00
|
|
|
|
|
|
|
* In some condition, `[x, y].max` and `[x, y].min` are optimized
|
|
|
|
so that a temporal array is not created. The concrete condition is
|
|
|
|
an implementation detail: currently, the array literal must have no
|
|
|
|
splat, must have at least one expression but literal, the length must
|
|
|
|
be <= 0x100, and Array#max and min must not be redefined. It will work
|
|
|
|
in most casual and real-life use case where it is written with intent
|
|
|
|
to `Math.max(x, y)`.
|
2016-06-13 08:34:06 -04:00
|
|
|
|
|
|
|
* Thread deadlock detection now shows their backtrace and dependency. [Feature #8214]
|