1# -*- rdoc -*-
2
3= NEWS for Ruby 2.1.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.
11
12== Changes since the 2.0.0 release
13
14=== Language changes
15
16* Now the default values of keyword arguments can be omitted.  Those
17  "required keyword arguments" need giving explicitly at the call time.
18
19* Added suffixes for integer and float literals: 'r', 'i', and 'ri'.
20  * "42r" and "3.14r" are evaluated as Rational(42, 1) and 3.14.rationalize,
21    respectively.  But exponential form with 'r' suffix like "6.022e+23r" is
22    not accepted because it is misleading.
23  * "42i" and "3.14i" are evaluated as Complex(0, 42) and Complex(0, 3.14),
24    respectively.
25  * "42ri" and "3.14ri" are evaluated as Complex(0, 42r) and Complex(0, 3.14r),
26    respectively.
27
28* def-expr now returns the symbol of its name instead of nil.
29
30=== Core classes updates (outstanding ones only)
31
32* Array
33  * New methods
34    * Array#to_h converts an array of key-value pairs into a Hash.
35
36* Binding
37  * New methods
38    * Binding#local_variable_get(symbol)
39    * Binding#local_variable_set(symbol, obj)
40    * Binding#local_variable_defined?(symbol)
41
42* Enumerable
43  * New methods
44    * Enumerable#to_h converts a list of key-value pairs into a Hash.
45
46* Exception
47  * New methods
48    * Exception#cause provides the previous exception which has been caught
49      at where raising the new exception.
50
51* GC
52  * improvements:
53    * introduced the generational GC a.k.a RGenGC.
54  * added environment variables:
55    * RUBY_GC_HEAP_INIT_SLOTS
56    * RUBY_GC_HEAP_FREE_SLOTS
57    * RUBY_GC_HEAP_GROWTH_FACTOR
58    * RUBY_GC_HEAP_GROWTH_MAX_SLOTS
59    * RUBY_GC_MALLOC_LIMIT_MAX
60    * RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR
61    * RUBY_GC_OLDMALLOC_LIMIT
62    * RUBY_GC_OLDMALLOC_LIMIT_MAX
63    * RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR
64  * obsoleted environment variables:
65    * RUBY_FREE_MIN (Use RUBY_GC_HEAP_FREE_SLOTS instead)
66    * RUBY_HEAP_MIN_SLOTS (Use RUBY_GC_HEAP_INIT_SLOTS instead)
67
68* Integer
69  * New methods
70    * Fixnum#bit_length
71    * Bignum#bit_length
72  * Bignum performance improvement
73    * Use GMP if available.
74      GMP is used only for several operations:
75      multiplication, division, radix conversion, GCD
76
77* IO
78  * extended methods:
79    * IO#seek supports SEEK_DATA and SEEK_HOLE as whence.
80    * IO#seek accepts symbols (:CUR, :END, :SET, :DATA, :HOLE) for 2nd argument.
81    * IO#read_nonblock accepts optional `exception: false` to return symbols
82    * IO#write_nonblock accepts optional `exception: false` to return symbols
83
84* Kernel
85  * New methods:
86    * Kernel#singleton_method
87
88* Module
89  * New methods:
90    * Module#using, which activates refinements of the specified module only
91      in the current class or module definition.
92    * Module#singleton_class? returns true if the receiver is a singleton class
93      or false if it is an ordinary class or module.
94  * extended methods:
95    * Module#refine is no longer experimental.
96    * Module#include and Module#prepend are now public methods.
97
98* Mutex
99  * misc
100    * Mutex#owned? is no longer experimental.
101
102* Numeric
103  * extended methods:
104    * Numeric#step allows the limit argument to be omitted, in which
105      case an infinite sequence of numbers is generated.  Keyword
106      arguments `to` and `by` are introduced for ease of use.
107      `by` can be 0, in which case the same value will be generated
108      indefinitely.
109
110* Process
111  * New methods:
112    * alternative methods to $0/$0=:
113      * Process.argv0() returns the original value of $0.
114      * Process.setproctitle() sets the process title without affecting $0.
115    * Process.clock_gettime
116    * Process.clock_getres
117
118* String
119  * "literal".freeze is now optimized to return the same object
120  * New methods:
121    * String#scrub and String#scrub! verify and fix invalid byte sequence.
122      If you want to use this function with older Ruby,
123      consider to use string-scrub.gem.
124
125* Symbol
126  * All symbols are now frozen.
127
128* pack/unpack (Array/String)
129  * Q! and q! directives for long long type if platform has the type.
130
131* toplevel
132  * extended methods:
133    * main.using is no longer experimental. The method activates refinements
134      in the ancestors of the argument module to support refinement
135      inheritance by Module#include.
136
137=== Core classes compatibility issues (excluding feature bug fixes)
138
139* Hash
140  * incompatible changes:
141    * Hash#reject will return plain Hash object in the future versions, that
142      is the original object's subclass, instance variables, default value,
143      and taintedness will be no longer copied, so now warnings are emitted
144      when called with such Hash.
145
146* IO
147  * incompatible changes:
148    * open ignore internal encoding if external encoding is ASCII-8BIT.
149
150* Kernel#eval, Kernel#instance_eval, and Module#module_eval.
151  * Copies the scope information of the original environment, which means
152    that private, protected, public, and module_function without arguments
153    do not affect the environment outside the eval string.
154    For example, `class Foo; eval "private"; def foo; end; end' doesn't make
155    Foo#foo private.
156
157* Kernel#untrusted?, untrust, and trust
158  * These methods are deprecated and their behavior is same as tainted?,
159    taint, and untaint, respectively.  If $VERBOSE is true, they show warnings.
160
161* Module#ancestors
162  * The ancestors of a singleton class now include singleton classes,
163    in particular itself.
164
165* Module#define_method and Object#define_singleton_method
166  * Now they return the symbols of the defined methods, not the methods/procs
167    themselves.
168
169* Numeric#quo
170  * Raises TypeError instead of ArgumentError if the receiver doesn't have
171    to_r method.
172
173* Proc
174  * Returning from lambda proc now always exits from the Proc, not from the
175    method where the lambda is created.  Returning from non-lambda proc exits
176    from the method, same as the former behavior.
177
178String
179  * If invalid: :replace is specified for String#encode, replace
180    invalid byte sequence even if the destination encoding equals to
181    the source encoding.
182
183=== Stdlib updates (outstanding ones only)
184
185* CGI::Util
186  * All class methods modulized.
187
188* Digest
189  * extended methods:
190    * Digest::Class.file takes optional arguments for its constructor
191
192* Matrix
193  * Added Vector#cross_product.
194
195* Net::SMTP
196  * Added Net::SMTP#rset to implement the RSET command
197
198* objspace
199  * new method:
200    * ObjectSpace.trace_object_allocations
201    * ObjectSpace.trace_object_allocations_start
202    * ObjectSpace.trace_object_allocations_stop
203    * ObjectSpace.trace_object_allocations_clear
204    * ObjectSpace.allocation_sourcefile
205    * ObjectSpace.allocation_sourceline
206    * ObjectSpace.allocation_class_path
207    * ObjectSpace.allocation_method_id
208    * ObjectSpace.allocation_generation
209    * ObjectSpace.reachable_objects_from_root
210    * ObjectSpace.dump
211    * ObjectSpace.dump_all
212
213* OpenSSL::BN
214  * extended methods:
215    * OpenSSL::BN.new allows Fixnum/Bignum argument.
216
217* open-uri
218  * Support multiple fields with same field name (like Set-Cookie).
219
220* Pathname
221  * New methods:
222    * Pathname#write
223    * Pathname#binwrite
224
225* rake
226  * Updated to 10.1.0.  Major changes include removal of the class namespace,
227    Rake::DSL to hold the rake DSL methods and removal of support for legacy
228    rake features.
229
230    For a complete list of changes since rake 0.9.6 see:
231
232    http://rake.rubyforge.org/doc/release_notes/rake-10_1_0_rdoc.html
233
234    http://rake.rubyforge.org/doc/release_notes/rake-10_0_3_rdoc.html
235
236* RbConfig
237  * New constants:
238    * RbConfig::SIZEOF is added to provide the size of C types.
239
240* RDoc
241  * Updated to 4.1.0.  Major enhancements include a modified default template
242  * and accessibility enhancements.
243
244    For a list of minor enhancements and bug fixes see:
245    https://github.com/rdoc/rdoc/blob/v4.1.0.preview.1/History.rdoc
246
247* Resolv
248  * New methods:
249    * Resolv::DNS.fetch_resource
250  * One-shot multicast DNS support
251  * Support LOC resources
252
253* REXML::Parsers::SAX2Parser
254  * Fixes wrong number of arguments of entitydecl event. Document of the event
255    says "an array of the entity declaration" but implementation passes two
256    or more arguments. It is an implementation bug but it breaks backward
257    compatibility.
258
259* REXML::Parsers::StreamParser
260  * Supports "entity" event.
261
262* REXML::Text
263  * REXML::Text#<< supports method chain like 'text << "XXX" << "YYY"'.
264  * REXML::Text#<< supports not "raw" mode.
265
266* Rinda::RingServer, Rinda::RingFinger
267  * Rinda now supports multicast sockets.  See Rinda::RingServer and
268    Rinda::RingFinger for details.
269
270* RubyGems
271  * Updated to 2.2.0.  Notable new features include:
272
273    * Gemfile or gem.deps.rb support including Gem.file.lock (experimental)
274    * Improved, iterative resolver (compared to RubyGems 2.1 and earlier)
275    * Support for a sharing a GEM_HOME across ruby platforms and versions
276
277    For a complete list of enhancements and bug fixes see:
278    https://github.com/rubygems/rubygems/tree/master/History.txt
279
280* Set
281  * New methods:
282    * Set#intersect?
283    * Set#disjoint?
284
285* Socket
286  * New methods:
287    * Socket.getifaddrs
288
289* StringScanner
290  * extended methods:
291    * StringScanner#[] supports named captures.
292
293* Syslog::Logger
294  * Added facility.
295
296* Tempfile
297  * New methods:
298    * Tempfile.create
299
300* Timeout
301  * The exception to terminate the given block can no longer be rescued
302    inside the block, by default, unless the exception class is given
303    explicitly.
304
305* TSort
306  * New methods:
307    * TSort.tsort
308    * TSort.tsort_each
309    * TSort.strongly_connected_components
310    * TSort.each_strongly_connected_component
311    * TSort.each_strongly_connected_component_from
312
313* WEBrick
314  * The body of a response may now be a StringIO or other IO-like that responds
315    to #readpartial and #read.
316
317* XMLRPC::Client
318  * New methods:
319    * XMLRPC::Client#http. It returns Net::HTTP for the client. Normally,
320      it is not needed. It is useful when you want to change minor HTTP client
321      options. You can change major HTTP client options by XMLRPC::Client
322      methods. You should use XMLRPC::Client methods for changing major
323      HTTP client options instead of XMLRPC::Client#http.
324
325=== Stdlib compatibility issues (excluding feature bug fixes)
326
327* Set
328  * incompatible changes:
329    * Set#to_set now returns self instead of generating a copy.
330
331* URI
332  * incompatible changes:
333    * URI.decode_www_form follows current WHATWG URL Standard.
334      It gets encoding argument to specify the character encoding.
335      It now allows loose percent encoded strings, but denies ;-separator.
336    * URI.encode_www_form follows current WHATWG URL Standard.
337      It gets encoding argument to convert before percent encode.
338      UTF-16 strings aren't converted to UTF-8 before percent encode by default.
339
340* curses
341  * Removed.
342    curses is now available as a gem.
343    See https://rubygems.org/gems/curses for details.
344
345=== Built-in global variables compatibility issues
346
347* $SAFE
348  * $SAFE=4 is obsolete.  If $SAFE is set to 4 or larger, an ArgumentError
349    is raised.
350
351=== C API updates
352
353* rb_gc_set_params() is deprecated. This is only used in Ruby internal.
354
355* rb_gc_count() added. This returns the number of times GC occurred.
356
357* rb_gc_stat() added. This allows access to specific GC.stat() values from C
358  without any allocation overhead.
359
360* rb_gc_latest_gc_info() added. This allows access to GC.latest_gc_info().
361
362* rb_postponed_job_register() added. Takes a function callback which is invoked
363  when the VM is in a consistent state, i.e. to perform work from a C signal
364  handler.
365
366* rb_profile_frames() added. Provides low-cost access to the current ruby stack
367  for callstack profiling.
368
369* rb_tracepoint_new() supports new internal events accessible only from C:
370  * RUBY_INTERNAL_EVENT_NEWOBJ
371  * RUBY_INTERNAL_EVENT_FREEOBJ
372  * RUBY_INTERNAL_EVENT_GC_START
373  * RUBY_INTERNAL_EVENT_GC_END_MARK
374  * RUBY_INTERNAL_EVENT_GC_END_SWEEP
375  * Note that you *can not* specify "internal events" with normal events
376    (such as RUBY_EVENT_CALL, RUBY_EVENT_RETURN) simultaneously.
377