summaryrefslogtreecommitdiff
path: root/NEWS
blob: 6b77714162bf89e1164029aa901de697c5b1190a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# -*- 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

* Multiple assignment in conditional expression is now allowed.
  [Feature #10617]

* Refinements is enabled at method by Symbol#to_proc.  [Feature #9451]

* Refinements is enabled with Kernel#send and BasicObject#__send__.
  [Feature #11476]

* Rescue modifier now applicable to method arguments.
  [Feature #12686]

=== Core classes updates (outstanding ones only)

* Array

  * 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.

  * Array#sum  [Feature #12217]
    This is different from Enumerable#sum in that Array#sum doesn't depend on
    the definition of each method.

  * Array#concat [Feature #12333]
    Now takes multiple arguments.

* Comparable

  * Comparable#clamp.  [Feature #10594]

* Dir

  * Dir.empty?.  [Feature #10121]

* Enumerable

  * Enumerable#sum  [Feature #12217]
  * Enumerable#uniq  [Feature #11090]
  * Enumerable#chunk called without a block now return an Enumerator
    [Feature #2172]

* Enumerator::Lazy

  * Enumerator::Lazy#uniq  [Feature #11090]

* File

  * File.empty?.  [Feature #9969]

* Float

  * Float#ceil, Float#floor, and Float#truncate now take an optional
    digits, as well as Float#round.  [Feature #12245]

* Hash

  * Hash#transform_values and Hash#transform_values!  [Feature #12512]
  * Hash#compact and Hash#compact!  [Feature #11818]

* Integer

  * Integer#ceil, Integer#floor, and Integer#truncate now take an optional
    digits, as well as Integer#round.  [Feature #12245]

  * Fixnum and Bignum are unified into Integer  [Feature #12005]

  * Integer#digits for extracting columns of place-value notation [Feature #12447]

* Kernel

  * Kernel#clone now takes an optional keyword argument, freeze flag.
    [Feature #12300]

* MatchData

  * MatchData#named_captures [Feature #11999]
  * MatchData#values_at supports named captures [Feature #9179]

* Module

  * Module.used_modules [Feature #7418]

* Numeric

  * Numeric#finite?, Numeric#infinite? [Feature #12039]

* Process

  * Support CLOCK_MONOTONIC_RAW_APPROX, CLOCK_UPTIME_RAW, and
    CLOCK_UPTIME_RAW_APPROX which are introduced by macOS 10.12.

* Regexp

  * Regexp#match? [Feature #8110]
    This returns bool and doesn't save backref.

* Regexp/String: Updated Unicode version from 8.0.0 to 9.0.0 [Feature #12513]

* RubyVM::Env

  * RubyVM::Env was removed.

* String

  * String#upcase, String#downcase, String#capitalize, String#swapcase and
    their bang variants work for all of Unicode, and are no longer limited
    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
    of String#downcase for details. [Feature #10085]

  * String.new(capacity: size) [Feature #12024]

  * String#concat, String#prepend [Feature #12333]
    Now takes multiple arguments.

* Symbol

  * Symbol#match now returns MatchData.  [Bug #11991]

  * 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]

* Thread

  * Thread#report_on_exception and Thread.report_on_exception
    [Feature #6647]

* Warning

  * New module named Warning is introduced.  By default it has only
    one singleton method, named warn.  This makes it possible for
    3rd-party libraries to control the way warnings are handled.
    [Feature #12299]

=== Stdlib updates (outstanding ones only)

* CGI

  * Don't allow , as a separator [Bug #12791]

* CSV

  * Add a liberal_parsing option. [Feature #11839]

* Logger

	* Allow specifying logger parameters in constructor such
	  as level, progname, datetime_format, formatter. [Feature #12224]
	* Add shift_period_suffix option. [Feature #10772]

* 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]

* Readline
  * Readline.quoting_detection_proc and Readline.quoting_detection_proc=
    [Feature #12659]

* optparse

  * Add an into option. [Feature #11191]

* WEBrick

  * Don't allow , as a separator [Bug #12791]

=== Compatibility issues (excluding feature bug fixes)

* Array#sum and Enumerable#sum are implemented.  [Feature #12217]
  Ruby itself has no compatibility problem because Ruby didn't have sum method
  for arrays before Ruby 2.4.
  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.

* 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).
  At C-level, Fixnum object and Bignum object should be distinguished by
  FIXNUM_P(obj) and RB_TYPE_P(obj, T_BIGNUM).
  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.
  The C-level constants, rb_cFixnum and rb_cBignum, is removed.
  They can cause compilation failure.

* 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.

* TRUE / FALSE / NIL
  These constants are now obsoleted. [Feature #12574]
  Use true / false / nil resp. instead.

=== Stdlib compatibility issues (excluding feature bug fixes)

* DateTime

  * DateTime#to_time now preserves timezone.  [Bug #12189]

* Time

  * Time#to_time now preserves timezone.  [Bug #12271]

* 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.

* Tk
  * Tk is removed from stdlib.  [Feature #8539]
    https://github.com/ruby/tk is the new upstream.

=== C API updates

* 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.

* rb_gc_adjust_memory_usage() [Feature #12690]

=== Supported platform changes

* FreeBSD < 4 is no longer supported

=== Implementation improvements

* 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)`.

* Thread deadlock detection now shows their backtrace and dependency. [Feature #8214]