1# -*- rdoc -*-
2
3= NEWS for Ruby 2.3.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.2.0 release
14
15=== Language changes
16
17* frozen-string-literal pragma:
18
19  * new pragma, frozen-string-literal has been experimentally introduced.
20    [Feature #8976]
21  * besides, --enable/--disable=frozen-string-literal options also have
22    been introduced. [Feature #8976]
23  * command line options --debug or --debug=frozen-string-literal enable
24    additional debugging mode which shows created location with at frozen
25    object error (RuntimeError).
26    [Feature #11725]
27
28* safe navigation operator:
29
30  * new method call syntax, `object&.foo', method #foo is called on
31    `object' if it is not nil.
32    this is similar to `try!' in Active Support, except:
33    * method name is syntactically required
34          obj.try! {} # valid
35          obj&. {}    # syntax error
36    * arguments are evaluated only if a call is made:
37          obj.try!(:foo, bar())  # bar() is always evaluated
38          obj&.foo(bar())        # bar() is conditionally evaluated
39    * attribute assignment is valid
40          obj&.attr += 1
41    [Feature #11537]
42
43* the did_you_mean gem:
44
45  * When a NameError or NoMethodError occurs because of a typo in the name,
46    the did_you_mean gem automatically suggests other names similar to the
47    method name.
48
49      "Yuki".starts_with?("Y")
50      # => NoMethodError: undefined method `starts_with?' for "Yuki":String
51      #    Did you mean?  start_with?
52
53* indented here document:
54
55  * new string literal, here document starts with `<<~`.
56    refer doc/syntax/literals.rdoc for more details.
57    [Feature #9098]
58
59=== Core classes updates (outstanding ones only)
60
61* ARGF
62
63  * ARGF.read_nonblock supports `exception: false' like IO#read_nonblock.
64    [Feature #11358]
65
66* Array
67
68  * Array#bsearch_index [Feature #10730]
69  * Array#dig [Feature #11643]
70
71* Comparable
72
73  * Comparable#== no longer rescues exceptions [Feature #7688]
74
75* Encoding
76
77  * new Encoding::IBM037 (alias ebcdic-cp-us; dummy)
78
79* Enumerable
80
81  * Enumerable#grep_v is added as inverse version of Enumerable#grep.
82    [Feature #11049]
83  * Enumerable#chunk_while [Feature #10769]
84
85* Enumerator::Lazy
86
87  * Enumerator::Lazy#grep_v [Feature #11773]
88
89* File
90
91  * File.mkfifo [Feature #11536]
92  * Add File::TMPFILE corresponding to O_TMPFILE
93
94* Hash
95
96  * Hash#fetch_values [Feature #10017]
97  * Hash#dig [Feature #11643]
98  * Hash#<=, Hash#<, Hash#>=, Hash#> [Feature #10984]
99  * Hash#to_proc [Feature #11653]
100
101* IO
102
103  * new mode flag File::SHARE_DELETE is available.
104    this flag means to permit deleting opened file on Windows, but currently
105    this affect only files opened as binary.  [Feature #11218]
106
107  * new option parameter `flags' is added.
108    this parameter is bitwise-ORed to oflags generated by normal mode argument.
109    [Feature #11253]
110
111  * IO#advise no longer raises Errno::ENOSYS in cases where it was
112    detected at build time but not available at runtime.  [Feature #11806]
113
114* Kernel
115
116  * Kernel#loop, when stopped by a StopIteration exception, returns
117    what the enumerator has returned instead of nil. [Feature #11498]
118
119* Module
120  * Module#deprecate_constant [Feature #11398]
121
122* NameError
123  * NameError#receiver is added to take the receiver object. [Feature #10881]
124
125* Numeric
126
127  * Numeric#positive? and Numeric#negative? are added, which return
128    true when the receiver is positive and negative respectively.
129    [Feature #11151]
130
131* Proc
132
133  * Proc#call (and also #[], #===, #yield) are optimized.
134    Backtrace doesn't show each method (show block lines directly).
135    TracePoint also ignores these calls. [Feature #11569]
136
137* Queue (Thread::Queue)
138
139  * Queue#close is added to notice a termination. [Feature #10600]
140
141* Regexp/String: Updated Unicode version from 7.0.0 to 8.0.0
142
143* RubyVM::InstructionSequence
144  * add the following methods as a primitive tool of iseq loader.
145    See sample/iseq_loader.rb for usage.
146    Note that loader does not have verifier so it is easy to cause
147    critical problem by loading modified/broken binary data.
148    See [Feature #11788] for more details. (experimental feature)
149    * RubyVM::InstructionSequence#to_binary(extra_data = nil)
150    * RubyVM::InstructionSequence.load_from_binary(binary)
151    * RubyVM::InstructionSequence.load_from_binary_extra_data(binary)
152
153* String
154
155  * String#+@ and String#-@ are added to get mutable/frozen strings.
156    [Feature #11782]
157
158  * String.new now accepts new option parameter `encoding'.
159    [Feature #11785]
160
161* Struct
162  * Struct#dig [Feature #11688]
163
164* Thread
165  * Thread#name, Thread#name= are added to handle thread names [Feature #11251]
166
167=== Core classes compatibility issues (excluding feature bug fixes)
168
169* Array
170  * Array#select!, Array#keep_if, Array#reject!, and Array#delete_if
171    no longer changes the receiver array instantly every time the
172    block is called.  [Feature #10714]
173
174  * Array#flatten and Array#flatten! no longer try to call #to_ary
175    method on elements beyond the given level.  [Bug #10748]
176
177  * Array#inspect doesn't raise error even if its content returns
178    a string which is not compatible with Encoding.default_external
179    as inspected result. [Feature #11801]
180
181* Enumerable
182  * Enumerable#chunk and Enumerable#slice_before no longer takes the
183    initial_state argument.  [Feature #10958]
184    Use a local variable instead to maintain a state.
185
186* File::Stat
187  * On Windows File::Stat#ino always returned 0, but now returns
188    BY_HANDLE_FILE_INFORMATION.nFileIndexHigh/Low.  [Feature #11216]
189
190* Hash
191  * Hash#inspect doesn't raise error even if its content returns
192    a string which is not compatible with Encoding.default_external
193    as inspected result. [Feature #11801]
194
195* IO
196  * IO#close doesn't raise when the IO object is closed.  [Feature #10718]
197  * IO#each_codepoint raises an exception at incomplete character
198    before EOF when conversion takes place.  [Bug #11444]
199
200* Module
201  * Module#define_method and Object.define_singleton_method now
202    require method body, Proc, Method, or a block, and raise
203    ArgumentError if no block is given directly.  [Bug #11283]
204
205* pack/unpack (Array/String)
206  * j and J directives for pointer width integer type.  [Feature #11215]
207
208
209=== Stdlib updates (outstanding ones only)
210
211* Logger
212
213  * Logger#level= now supports symbol and string levels such as :debug, :info,
214    :warn, :error, :fatal (case insensitive) [Feature #11695]
215  * Logger#reopen is added to reopen a log device. [Feature #11696]
216
217* io/wait
218  * IO#wait_readable no longer checks FIONREAD, it may be used for
219    non-bytestream IO such as listen sockets.
220
221* Net::FTP
222  * Net::FTP#mlst is added.
223  * Net::FTP#mlsd is added.
224
225* nkf
226  * Merge nkf 2.1.4.
227
228* ObjectSpace (objspace)
229  * ObjectSpace.count_symbols is added.
230  * ObjectSpace.count_imemo_objects is added.
231  * ObjectSpace.internal_class_of is added.
232  * ObjectSpace.internal_super_of is added.
233
234* OpenSSL
235  * OpenSSL::SSL::SSLSocket#accept_nonblock and
236    OpenSSL::SSL::SSLSocket#connect_nonblock supports `exception: false`.
237    [Feature #10532]
238
239* Pathname
240  * Pathname#descend and Pathname#ascend supported blockless form.
241    [Feature #11052]
242
243* Socket
244  * Socket#connect_nonblock, Socket#accept_nonblock,
245    TCPServer#accept_nonblock, UNIXServer#accept_nonblock,
246    BasicSocket#recv_nonblock, BasicSocket#recvmsg_nonblock,
247    BasicSocket#sendmsg_nonblock all support `exception: false` to return
248    :wait_readable or :wait_writable symbols instead of raising
249    IO::WaitReadable or IO::WaitWritable exceptions
250    [Feature #10532] [Feature #11229]
251  * BasicSocket#recv and BasicSocket#recv_nonblock allow an output
252    String buffer argument like IO#read and IO#read_nonblock to reduce
253    GC overhead [Feature #11242]
254
255* StringIO
256  * In read-only mode, StringIO#set_encoding no longer sets the encoding
257    of its buffer string.  Setting the encoding of the string directly
258    without StringIO#set_encoding may cause unpredictable behavior now.
259    [Bug #11827]
260
261* timeout
262  * Object#timeout is now warned as deprecated when called.
263
264=== Stdlib compatibility issues (excluding feature bug fixes)
265
266* ext/coverage/coverage.c
267  * Coverage.peek_result: new method to allow coverage to be captured without
268    stopping the coverage tool.  [Feature #10816]
269
270* Fiddle
271  * Fiddle::Function#call releases the GVL.  [Feature #11607]
272
273* io-console
274  * Update to io-console 0.4.5, and change the license to BSD 2-clause
275    "Simplified" License.
276
277* lib/base64.rb
278  * Base64.urlsafe_encode64: added a "padding" option to suppress
279    the padding character ("=").  [Feature #10740]
280  * Base64.urlsafe_decode64: now it accepts not only correctly-padded
281    input but also unpadded input.  [Feature #10740]
282
283* lib/drb/drb.rb
284  * removed unused argument. https://github.com/ruby/ruby/pull/515
285
286* lib/matrix.rb
287  * Add Vector#round. https://github.com/ruby/ruby/pull/802
288
289* lib/webrick/utils.rb
290  * removed unused argument. https://github.com/ruby/ruby/pull/356
291
292* Net::FTP
293  * Connections are in passive mode per default now.  The default mode can
294    be changed by Net::FTP.default_passive=.  [Feature #11612]
295
296* Net::HTTP
297  * default value of Net::HTTP#open_timeout is now 60 (was nil).
298
299* Net::Telnet
300  * Net::Telnet is extracted to net-telnet gem. It's unmaintain code.
301    [Feature #11083]
302
303* Psych
304  * Updated to Psych 2.0.17
305
306* Rake
307  * Rake is removed from stdlib.  [Feature #11025]
308
309* RDoc
310  * Updated to RDoc 4.2.1.  For full release notes see:
311
312    https://github.com/rdoc/rdoc/blob/master/History.rdoc#421--2015-12-22
313
314* RubyGems
315  * Updated to RubyGems 2.5.1.  For full release notes see:
316
317    http://docs.seattlerb.org/rubygems/History_txt.html#label-2.5.0+-2F+2015-11-03
318    and
319    http://docs.seattlerb.org/rubygems/History_txt.html#label-2.5.1+-2F+2015-12-10
320
321=== Built-in global variables compatibility issues
322
323* $SAFE
324  * $SAFE=2 and $SAFE=3 are obsolete.  If $SAFE is set to 2 or larger,
325    an ArgumentError is raised.  [Feature #5455]
326
327=== C API updates
328
329* rb_define_class_id_under() now raises a TypeError exception when the
330  class is already defined but its superclass does not match the given
331  superclass, as well as definitions in ruby level.
332
333* rb_timespec_now() is added to fetch current datetime as struct timespec.
334  [Feature #11558]
335
336* rb_time_timespec_new() is added to create a time object with epoch,
337  nanosecond, and UTC/localtime/time offset arguments.  [Feature #11558]
338
339* rb_autoload() deprecated, use rb_funcall() instead.  [Feature #11664]
340
341* rb_compile_error_with_enc(), rb_compile_error(), and rb_compile_bug()
342  deprecated.  these functions are exposed but only for internal use.
343  external libraries should not use them.
344
345=== Supported platform changes
346
347* OS/2 is no longer supported
348
349* BeOS is no longer supported
350
351* Borland-C is no longer supported
352
353* Haiku now stable and best effort
354
355=== Implementation improvements
356
357* Optimize Proc#call to eliminate method frame construction.
358  [Feature #11569]
359
360* Reconsidering method entry data structure.
361  [Bug #11278]
362
363* Introducing new table data structure for ID keys tables used by
364  method table and so on. New table structure is simple and fast
365  than st_table. [Feature #11420]
366
367* Machine code level tuning for object allocation and method calling
368  code. r52099, r52254
369
370* RubyVM::InstructionSequence is extended for future improvement.
371  [Feature #11788]
372
373* Case dispatch is now optimized for all special constant literals
374  including nil, true, and false.  Previously, only literal strings,
375  symbols, integers and floats compiled to optimized case dispatch.
376  [Feature #11769]
377
378* Instance variables on non-pure Ruby classes (T_DATA, T_FILE,
379  etc..) is less expensive to store than before. [Feature #11170]
380
381* All accesses to members of big Struct objects are performed in
382  constant-time.  Previously, Struct elements beyond the first 10
383  elements used a linear scan. [Feature #10585]
384
385* The Set class got several speed up.
386  [Misc #10754], [r52591]
387
388* Socket and I/O-related improvements
389
390  * Calling overhead of most of new keyword-using I/O methods in
391    [Feature #11229] is reduced by avoiding the inefficient C API
392    to parse keywords.  [Feature #11339]
393
394  * The standard library is updated to use the improved
395    exception-free non-blocking I/O from [Feature #11229].
396    This has the additional benefit of quieter $DEBUG output in
397    addition to reducing expensive exceptions. [Feature #11044]
398
399  * (Linux-only) waiting on a single FD anywhere in the stdlib no longer
400    uses select(2), making it immune to slowdowns with high-numbered FDs.
401    [Feature #11081] [Feature #11377]
402
403* CGI.escapeHTML is optimized with C extension.
404  https://github.com/ruby/ruby/pull/1164
405