1# -*- rdoc -*-
2
3= NEWS for Ruby 2.4.0
4
5This document is a list of user visible feature changes made between
6releases except for bug fixes.
7
8Note that each entry is kept so brief that no reason behind or
9reference information is supplied with.  For a full list of changes
10with all sufficient information, see the ChangeLog file or Redmine
11(e.g. <tt>https://bugs.ruby-lang.org/issues/$FEATURE_OR_BUG_NUMBER</tt>)
12
13== Changes since the 2.3.0 release
14
15=== Language changes
16
17* Multiple assignment in conditional expression is now allowed.
18  [Feature #10617]
19
20* Refinements is enabled at method by Symbol#to_proc.  [Feature #9451]
21
22* Refinements is enabled with Kernel#send and BasicObject#__send__.
23  [Feature #11476]
24
25* Rescue modifier now applicable to method arguments.
26  [Feature #12686]
27
28* Toplevel return is now allowed.  [Feature #4840]
29
30=== Core classes updates (outstanding ones only)
31
32* Array
33
34  * Array#concat [Feature #12333]
35    Now takes multiple arguments.
36
37  * Array#max and Array#min.  [Feature #12172]
38    This may cause a tiny incompatibility: if you redefine
39    Enumerable#max and call max to an Array, your redefinition will be
40    now ignored.  You should also redefine Array#max.
41
42  * Array#pack [Feature #12754]
43    Now takes optional argument `buffer:' to reuse already allocated buffer.
44
45  * Array#sum  [Feature #12217]
46    This is different from Enumerable#sum in that Array#sum doesn't depend on
47    the definition of each method.
48
49* Comparable
50
51  * Comparable#clamp.  [Feature #10594]
52
53* Dir
54
55  * Dir.empty?.  [Feature #10121]
56
57* Enumerable
58
59  * Enumerable#chunk called without a block now return an Enumerator
60    [Feature #2172]
61  * Enumerable#sum  [Feature #12217]
62  * Enumerable#uniq  [Feature #11090]
63
64* Enumerator::Lazy
65
66  * Enumerator::Lazy#chunk_while  [GH-1186]
67  * Enumerator::Lazy#uniq  [Feature #11090]
68
69* File
70
71  * File.empty?.  [Feature #9969]
72
73* Float
74
75  * Float#ceil, Float#floor, and Float#truncate now take an optional
76    digits, as well as Float#round.  [Feature #12245]
77
78  * Float#round now takes an optional keyword argument, half option, and
79    the default behavior is round-up.  [Bug #12548] [Bug #12958]
80    half option can be one of :even, :up, and :down.  [Feature #12953]
81
82* Hash
83
84  * Hash#compact and Hash#compact!  [Feature #11818]
85  * Hash#transform_values and Hash#transform_values!  [Feature #12512]
86
87* Integer
88
89  * Fixnum and Bignum are unified into Integer  [Feature #12005]
90
91  * Integer#ceil, Integer#floor, and Integer#truncate now take an optional
92    digits, as well as Integer#round.  [Feature #12245]
93
94  * Integer#digits for extracting columns of place-value notation [Feature #12447]
95
96  * Integer#round now takes an optional keyword argument, half option, and the
97    default behavior is round-up now.  [Bug #12548] [Bug #12958]
98    half option can be one of :even, :up, and :down.  [Feature #12953]
99
100* IO
101
102  * IO#gets, IO#readline, IO#each_line, IO#readlines, IO.foreach now takes
103    an optional keyword argument, chomp flag.  [Feature #12553]
104
105* Kernel
106
107  * Kernel#clone now takes an optional keyword argument, freeze flag.
108    [Feature #12300]
109
110* MatchData
111
112  * MatchData#named_captures [Feature #11999]
113  * MatchData#values_at supports named captures [Feature #9179]
114
115* Module
116
117  * Module#refine accepts a module as the argument now. [Feature #12534]
118  * Module.used_modules [Feature #7418]
119
120* Numeric
121
122  * Numeric#finite?, Numeric#infinite? [Feature #12039]
123
124* Process
125
126  * Support CLOCK_MONOTONIC_RAW_APPROX, CLOCK_UPTIME_RAW, and
127    CLOCK_UPTIME_RAW_APPROX which are introduced by macOS 10.12.
128
129* Rational
130
131  * Rational#round now takes an optional keyword argument, half option, and
132    the default behavior is round-up now.  [Bug #12548] [Bug #12958]
133    half option can be one of :even, :up, and :down.  [Feature #12953]
134
135* Regexp
136
137  * meta character \X matches Unicode 9.0 characters with some workarounds
138    for UTR #51 Unicode Emoji, Version 4.0 emoji zwj sequences.
139
140  * Regexp#match? [Feature #8110]
141    This returns bool and doesn't save backref.
142
143  * Update to Onigmo 6.0.0.
144
145* Regexp/String: Update Unicode version from 8.0.0 to 9.0.0 [Feature #12513]
146
147* RubyVM::Env
148
149  * RubyVM::Env was removed.
150
151* String
152
153  * String#casecmp? [Feature #12786]
154
155  * String#concat, String#prepend [Feature #12333]
156    Now takes multiple arguments.
157
158  * String#each_line, String#lines now takes an optional keyword argument,
159    chomp flag.  [Feature #12553]
160
161  * String#match? [Feature #12898]
162
163  * String#unpack1 [Feature #12752]
164
165  * String#upcase, String#downcase, String#capitalize, String#swapcase and
166    their bang variants work for all of Unicode, and are no longer limited
167    to ASCII. Supported encodings are UTF-8, UTF-16BE/LE, UTF-32BE/LE, and
168    ISO-8859-1~16. Variations are available with options. See the documentation
169    of String#downcase for details. [Feature #10085]
170
171  * String.new(capacity: size) [Feature #12024]
172
173* StringIO
174
175  * StringIO#gets, StringIO#readline, StringIO#each_line, StringIO#readlines now takes
176    an optional keyword argument, chomp flag.  [Feature #12553]
177
178* Symbol
179
180  * Symbol#casecmp? [Feature #12786]
181
182  * Symbol#match now returns MatchData.  [Bug #11991]
183
184  * Symbol#match? [Feature #12898]
185
186  * Symbol#upcase, Symbol#downcase, Symbol#capitalize, and Symbol#swapcase now
187    work for all of Unicode. See the documentation of String#downcase
188    for details. [Feature #10085]
189
190* Thread
191
192  * Thread#report_on_exception and Thread.report_on_exception
193    [Feature #6647]
194
195* TracePoint
196
197  * TracePoint#callee_id [Feature #12747]
198
199* Warning
200
201  * New module named Warning is introduced.  By default it has only
202    one singleton method, named warn.  This makes it possible for
203    3rd-party libraries to control the way warnings are handled.
204    [Feature #12299]
205
206=== Stdlib updates (outstanding ones only)
207
208* CGI
209
210  * Don't allow , as a separator [Bug #12791]
211
212* CSV
213
214  * Add a liberal_parsing option. [Feature #11839]
215
216* IPAddr
217
218  * IPAddr#== and IPAddr#<=> no longer raise an exception if coercion fails.
219    [Bug #12799]
220
221* IRB
222
223  * Binding#irb: Start a REPL session like `binding.pry` at r56624.
224
225* Logger
226
227  * Allow specifying logger parameters in constructor such
228    as level, progname, datetime_format, formatter. [Feature #12224]
229  * Add shift_period_suffix option. [Feature #10772]
230
231* Net::HTTP
232
233  * New method: Net::HTTP.post [Feature #12375]
234
235* Net::FTP
236
237  * Support TLS (RFC 4217).
238  * Support hash style options for Net::FTP.new.
239  * Add a new optional argument pathname to Net::FTP#status.
240    Contributed by soleboxy. [GH-1478] [Feature #12965]
241
242* OpenSSL
243
244  * Includes Ruby/OpenSSL 2.0. OpenSSL has been extracted as a Gem and is
245    maintained at a separate repository now: https://github.com/ruby/openssl.
246    It still remains as a 'default gem'.  [Feature #9612]
247    Refer to ext/openssl/History.md for the full release note.
248
249* optparse
250
251  * Add an into option. [Feature #11191]
252
253* pathname
254
255  * New method: Pathname#empty? [Feature #12596]
256
257* Readline
258
259  * Readline.quoting_detection_proc and Readline.quoting_detection_proc=
260    [Feature #12659]
261
262* REXML
263
264  * REXML::Element#[]: If String or Symbol is specified, attribute
265    value is returned. Otherwise, Nth child is returned. This is
266    backward compatible change.
267
268* set
269
270  * New methods: Set#compare_by_identity and Set#compare_by_identity?.
271    [Feature #12210]
272
273* WEBrick
274
275  * Don't allow , as a separator [Bug #12791]
276
277=== Compatibility issues (excluding feature bug fixes)
278
279* Array#sum and Enumerable#sum are implemented.  [Feature #12217]
280  Ruby itself has no compatibility problem because Ruby didn't have sum method
281  for arrays before Ruby 2.4.
282  However many third party gems, activesupport, facets, simple_stats, etc,
283  defines sum method.  These implementations are mostly compatible but
284  there are subtle differences.
285  Ruby's sum method should be mostly compatible but it is impossible to
286  be perfectly compatible with all of them.
287
288* Fixnum and Bignum are unified into Integer  [Feature #12005]
289  Fixnum class and Bignum class is removed.
290  Integer class is changed from abstract class to concrete class.
291  For example, 0 is an instance of Integer: 0.class returns Integer.
292  The constants Fixnum and Bignum is bound to Integer.
293  So obj.kind_of?(Fixnum) works as obj.kind_of?(Integer).
294  At C-level, Fixnum object and Bignum object should be distinguished by
295  FIXNUM_P(obj) and RB_TYPE_P(obj, T_BIGNUM).
296  RUBY_INTEGER_UNIFICATION can be used to detect this feature at C-level.
297  0.class == Integer can be used to detect this feature at Ruby-level.
298  The C-level constants, rb_cFixnum and rb_cBignum, are removed.
299  They can cause compilation failure.
300
301* String/Symbol#upcase/downcase/swapcase/capitalize(!) now work for all of
302  Unicode, not only for ASCII. [Feature #10085]
303  No change is needed if the data is in ASCII anyway or if the limitation
304  to ASCII was only tolerated while waiting for a more extensive implementation.
305  A change (using the :ascii option) is needed in cases where Unicode data
306  is processed, but the operation has to be limited to ASCII only.
307  A good example of this are internationalized domain names.
308
309* TRUE / FALSE / NIL
310  These constants are now obsoleted. [Feature #12574]
311  Use true / false / nil resp. instead.
312
313=== Stdlib compatibility issues (excluding feature bug fixes)
314
315* DateTime
316
317  * DateTime#to_time now preserves timezone.  [Bug #12189]
318
319* Psych
320
321  * Update to Psych 2.2.2
322
323* RDoc
324
325  * Update to RDoc 5.0.0
326
327* RubyGems
328
329  * Update to RubyGems 2.6.8
330
331* shellwords
332
333  * Shellwords.shellwords (shellsplit) treats the backslash as escape
334    character only when followed by one of the following characters:
335    $ ` " \ <newline>
336    [Bug #10055]
337
338* Time
339
340  * Time#to_time now preserves timezone.  [Bug #12271]
341
342* thread
343
344  * the extension library is removed.  Till 2.0 it was a pure ruby script
345    "thread.rb", which has precedence over "thread.so", and has been provided
346    in $LOADED_FEATURES since 2.1.
347
348* Tk
349
350  * Tk is removed from stdlib.  [Feature #8539]
351    https://github.com/ruby/tk is the new upstream.
352
353* XMLRPC
354
355  * XMLRPC is removed from stdlib, and bundled as gem. [Feature #12160][ruby-core:74239]
356    https://github.com/ruby/xmlrpc is the new upstream.
357
358* Zlib
359
360  * Zlib.gzip and Zlib.gunzip [Feature #13020]
361
362=== C API updates
363
364* ruby_show_version() will no longer exits the process, if
365  RUBY_SHOW_COPYRIGHT_TO_DIE is set to 0.  This will be the default in
366  the future.
367
368* rb_gc_adjust_memory_usage() [Feature #12690]
369
370=== Supported platform changes
371
372* FreeBSD < 4 is no longer supported
373
374=== Implementation improvements
375
376* In some condition, `[x, y].max` and `[x, y].min` are optimized
377  so that a temporal array is not created.  The concrete condition is
378  an implementation detail: currently, the array literal must have no
379  splat, must have at least one expression but literal, the length must
380  be <= 0x100, and Array#max and min must not be redefined.  It will work
381  in most casual and real-life use case where it is written with intent
382  to `Math.max(x, y)`.
383
384* Thread deadlock detection now shows their backtrace and dependency. [Feature #8214]
385
386* st_table (st.c) internal data structure is improved. [Feature #12142]
387
388* Rational is extensively optimized. [Feature #12484]
389
390=== Miscellaneous changes
391
392* ChangeLog is removed from the repository.
393  It is generated from commit messages in Subversion by `make dist`.
394  Also note that now people should follow Git style commit message.
395  The template is written at
396  [Short (50 chars or less) summary of changes](https://git-scm.com/book/ch5-2.html).
397  [Feature #12283]
398