1# -*- rdoc -*-
2
3= NEWS for Ruby 1.9.1
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 1.8.7 release
13See doc/NEWS-1.8.7 for changes between 1.8.6 and 1.8.7.
14
15=== Compatibility issues
16
17* language core
18
19    * New syntax and semantics
20          o Block arguments are always local
21          o New semantics for block arguments
22          o defined? and local variables
23          o Parser expects that your source code has only valid byte
24            sequence in some character encoding.  Use magic comments
25            to tell the parser which encoding you use.
26          o New semantics for constant definition in instance_eval
27            or in module_eval.
28
29    * Deprecated syntax
30          o colon (:) instead of "then" in if/unless or case expression.
31          o retry in a loop or an iterator.
32
33* builtin classes and objects
34
35    * Kernel and Object
36          o Kernel#methods and #singleton_methods used to return an
37            array of strings but now they return an array of symbols.
38    * Class and Module
39          o Module#attr works as Module#attr_reader by default.
40	    Optional boolean argument is obsolete.
41          o Module#instance_methods, #private_instance_methods and
42            #public_instance_methods used to return an array of
43            strings but now they return an array of symbols.
44          o Extra subclassing check when binding UnboundMethods
45
46    * Exceptions
47          o Exceptions are equal to each other if they belong to
48            the same class and have the same message and backtrace.
49          o SystemStackError used to be a subclass of StandardError
50            but not it is a direct subclass of Exception.
51          o SecurityError: ditto
52          o Removed Exception#to_str [Ruby2]
53
54    * Enumerable and Enumerator
55          o Enumerable::Enumerator, compatibility alias of Enumerator,
56            is removed.
57          o Enumerable#{map,collect} called without a block returns
58            an enumerator.
59          o Even more builtin and bundled libraries have been made to
60            return an enumerator when called without a block.
61    * Array
62          o Array#nitems was removed (use count {|i| !i.nil?})
63          o Array#choice was removed (use sample)
64          o Array#[m,n] = nil places nil in the array.
65    * Hash
66          o Hash#to_s is equivalent to Hash#inspect
67          o Semantics for Hash#each and Hash#each_pair
68          o Hash#select returns a hash
69          o Hash#key is the new name for #index which has been
70            deprecated.
71          o Hash preserves order.  It enumerates its elements in the
72            order in which the keys are inserted.
73          o Most of the changes in Hash apply to hash like interfaces
74            such as ENV and *DBM.
75    * IO operations
76          o Many methods used to act byte-wise but now some of those act
77            character-wise. You can use alternate byte-wise methods.
78          o IO#getc
79          o Non-blocking IO
80          o Kernel#open takes "t" for newline conversion
81          o Kernel#open takes encoding specified
82          o IO automatically converts byte sequence from a character
83            encodings into another if specified.
84          o StringIO#readpartial
85          o IO.try_convert
86          o IO.binread
87          o IO.copy_stream
88          o IO#binmode?
89          o IO#close_on_exec= and IO#close_on_exec?
90          o Limit input in IO#gets, IO#readline, IO#readlines,
91            IO#each_line, IO#lines, IO.foreach, IO.readlines,
92            StringIO#gets, StringIO#readline, StringIO#each,
93            StringIO#readlines
94          o IO#ungetc, StringIO#ungetc
95          o IO#ungetbyte, StringIO#ungetbyte
96          o IO#internal_encoding, IO#external_encoding,
97            IO#set_encoding
98          o IO.pipe takes encoding option
99          o Directive %u behaves like %d for negative values in
100            printf-style formatting.
101    * File and Dir operations
102          o #to_path is called as necessary in File.path, File.chmod,
103            File.lchmod, File.chown, File.lchown, File.utime,
104            File.unlink, etc..
105          o File.world_readable?
106          o File.world_writable?
107          o Dir.[], Dir.glob
108          o Dir.exist?
109          o Dir.exists?
110    * File::Stat
111          o File::Stat#world_readable?
112          o File::Stat#world_writable?
113    * String
114          o No longer an Enumerable: use each_line/lines for line
115            oriented operation
116          o Encoding-awareness
117              o Character-wise semantics in many methods instead of
118                byte-wise.
119                  o String#[]: Indexing a String with an integer returns a
120                    single character String instead of an integer.
121                  o String#[]=: No longer takes an integer as right
122                    side value.  Note that "str[i] = ?c" because of
123                    the following change.
124                  o ?c is evaluated to a single character string
125                    instead of an integer.
126    * Regexp
127          o Encoding-awareness
128          o Regexp matches only with strings which is encoded in a
129            compatible character encoding to the regexp's.
130          o Regexp#kcode is removed. use Regexp#encoding.
131    * Symbols: restriction on literal symbols
132    * Numeric
133          o Numeric#div always rounds as Integer#div has done.
134          o Numeric#fdiv: ditto.
135    * Integer
136          o Integer(nil) raises TypeError
137    * Fixnum
138          o Fixnum#id2name removed
139          o Fixnum#to_sym removed
140    * Struct
141          o Struct#inspect
142    * Time
143          o New format in Time#to_s
144          o Timezone information preserved on Marshal.dump/load
145    * $SAFE and bound methods
146          o New trusted/untrusted model in addition to
147            tainted/untainted model.
148
149    * Deprecation
150          o $= (global flag for case-sensitiveness on string matching)
151          o Kernel#to_a
152          o Kernel#getc, #gsub, #sub
153          o Kernel#callcc and Continuation now become 'continuation'
154            bundled library.
155          o Object#type
156          o Removed Array and Hash #indices, #indexes
157          o Hash#index
158          o ENV.index
159          o Process::Status#to_int
160          o Numeric#rdiv
161          o Precision is removed.  Don't cry, it will be redesigned
162            and come back in future version.
163          o Symbol#to_int and Symbol#to_i
164          o $KCODE is no longer effective.  Use Encoding related
165            features of each class.
166          o VERSION and friends
167
168* bundled libraries
169
170    * Pathname
171          o No longer has #to_str nor #=~.
172    * time and date
173          o Time.parse and Date.parse interprets slashed numerical dates
174	    as "dd/mm/yyyy".
175    * Readline
176          o If Readline uses libedit, Readline::HISTORY[0] returns the
177            first of the history.
178    * Continuation
179          o as above
180
181    * Deprecation
182          o Complex#image: use Complex#imag
183          o All SSL-related class methods in Net::SMTP
184          o Prime#cache, Prime#primes, Prime#primes_so_far
185          o mailread library: use tmail gem.
186          o cgi-lib library: use cgi.
187          o date2 library: use date.
188          o eregex library
189          o finalize library: use ObjectSpace.define_finalizer if you
190            really need a finalizer. really?
191          o ftools library: use fileutils.
192          o generator library: use Enumerator.
193          o importenv library and Env library
194          o jcode library: use multilingualization support of String
195          o parsedate library
196          o ping library
197          o readbytes library
198          o getopts library and parsearg library: use optparse or
199            getoptlong.
200          o soap, wsdl and xsd libraries: use soap4r gem.
201          o Win32API library: use dl.
202          o dl library: Reimplemented and API changed. use the new
203	    version of dl or ffi gem.
204          o rubyunit library and runit library: use minitest or
205            test/unit. Or use anything you love through RubyGems.
206          o test/unit is reimplemented on top of minitest.  This is
207            not fully compatible with the original.
208
209=== Language core changes
210
211    * New syntax and semantics
212          o Magic comments to declare in which encoding your source
213            code is written
214          o New literal hash syntax and new syntax for hash style
215	    arguments
216          o New syntax for lambdas
217          o .() and calling Procs without #call/#[]
218          o Block in block arguments
219          o Block local variables
220          o Mandatory arguments after optional arguments allowed
221          o Multiple splats allowed
222          o #[] can take splatted arguments, hash style arguments
223            and a block.
224          o New directives in printf-style formatted strings (%).
225          o Newlines allowed before ternary colon operator (:) and
226            method call dot operator (.)
227          o Negative operators such as !, != and !~ are now
228            overloadable
229          o Encoding.default_external and default_internal
230          o __ENCODING__: New pseudo variable to hold the current
231            script's encoding
232
233=== Library updates
234
235* builtin classes and objects
236    * Kernel and Object
237          o BasicObject
238          o Object#=~ returns nil instead of false by default.
239          o Kernel#define_singleton_method
240	  o Kernel#load can load a library from the highest versions
241	    of gems by default.
242    * Class and Module
243          o Module#const_defined?, #const_get and #method_defined?
244            take an optional parameter.
245          o #class_variable_{set,get} are public.
246          o Class of singleton classes
247
248    * Errno::EXXX
249          o All of those are always defined.  Errno::EXXX will be
250            defined as an alias to Errno::NOERROR if your platform
251            does not have one.
252
253    * Binding#eval
254    * Blocks and Procs
255          o Arity of blocks without arguments
256          o proc is now a synonym of Proc.new
257          o Proc#yield
258          o Passing blocks to #[]
259          o Proc#lambda?
260          o Proc#curry
261    * Fiber: coroutines/micro-threads
262    * Thread
263          o Thread.critical and Thread.critical= removed
264          o Thread#exit!, Thread#kill! and Thread#terminate! removed.
265
266    * Enumerable and Enumerator
267          o Enumerator#enum_cons and Enumerator#enum_slice are
268            removed.  Use #each_cons and #each_slice without a block.
269          o Enumerable#each_with_index can take optional arguments
270            and passes them to #each.
271          o Enumerable#each_with_object
272          o Enumerator#with_object
273          o Enumerator.new { ... }
274    * Array
275          o Array#delete returns a deleted element rather than a given
276            object
277          o Array#to_s is equivalent to Array#inspect
278          o Array.try_convert
279          o Array#pack('m0') complies with RFC 4648.
280    * Hash
281          o preserving item insertion order
282          o Hash#default_proc=
283          o Hash#_compare_by_identity and Hash#compare_by_identity?
284          o Hash.try_convert
285          o Hash#assoc
286          o Hash#rassoc
287          o Hash#flatten
288    * Range
289          o Range#cover?
290          o Range#include? iterates over elements and compares the
291            given value with each element unless the range is numeric.
292            Use Range#cover? for the old behavior, i.e. comparison
293            with boundary values.
294          o Range#min, Range#max
295
296    * File and Dir operations
297          o New methods
298    * Process
299          o Process.spawn
300          o Process.daemon
301    * String
302          o String#clear
303          o String#ord
304          o String#getbyte, String#setbyte
305          o String#chars and String#each_char act as character-wise.
306          o String#codepoints, String#each_codepoint
307          o String#unpack with a block
308          o String#hash
309          o String.try_convert
310          o String#encoding
311	  o String#force_encoding, String#encode and String#encode!
312          o String#ascii_only?
313          o String#valid_encoding?
314	  o String#match
315    * Symbol
316          o Zero-length symbols allowed
317          o Symbol#intern
318          o Symbol#encoding
319          o Symbol methods similar to those in String
320    * Regexp
321          o Regexp#=== matches symbols
322          o Regexp.try_convert
323          o Regexp#match
324          o Regexp#fixed_encoding?
325          o Regexp#encoding
326          o Regexp#named_captures
327          o Regexp#names
328    * MatchData
329          o MatchData#names
330          o MatchData#regexp
331    * Encoding
332    * Encoding::Converter
333          o supports conversion between many encodings
334    * Numeric
335          o Numeric#upto, #downto, #times, #step
336          o Numeric#real?, Complex#real?
337          o Numeric#magnitude
338          o Numeric#round
339    * Float
340          o Float#round
341    * Integer
342          o Integer#round
343    * Rational / Complex
344          o They are in the core library now
345    * Math
346          o Math#log takes an optional argument.
347          o Math#log2
348          o Math#cbrt, Math#lgamma, Math#gamma
349    * Time
350          o Time.times removed.  Use Process.times.
351          o Time#sunday?
352          o Time#monday?
353          o Time#tuesday?
354          o Time#wednesday?
355          o Time#thursday?
356          o Time#friday?
357          o Time#saturday?
358          o Time#tv_nsec and Time#nsec
359    * Misc. new methods
360          o RUBY_ENGINE to distinguish between Ruby processor implementation
361          o public_method
362          o public_send
363          o GC.count
364          o ObjectSpace.count_objects
365          o Method#hash, Proc#hash
366          o Method#source_location, UnboundMethod#source_location and
367	    Proc#source_location
368          o __callee__
369          o Elements in $LOAD_PATH and $LOADED_FEATURES are expanded
370
371* bundled libraries
372    * RubyGems
373          o Package management system for Ruby.
374          o Integrated with Ruby's library loader.
375    * Rake
376          o Ruby make. A simple ruby build program with capabilities
377            similar to make.
378    * minitest
379          o Our new testing library which is faster, cleaner and easier
380	    to read than the old test/unit.
381          o You can introduce the old test/unit as testunit gem through
382            RubyGems if you want.
383    * CMath
384          o Complex number version of Math
385    * Prime
386          o Extracted from Mathn and improved. You can easily enumerate
387            prime numbers.
388          o Prime.new is obsolete. Use its class methods.
389    * ripper
390          o Ruby script parser
391    * Readline
392          o Readline.vi_editing_mode?
393          o Readline.emacs_editing_mode?
394          o Readline::HISTORY.clear
395    * Tk
396          o TkXXX widget classes are removed and redefined as aliases of
397            Tk::XXX classes.
398    * RDoc
399          o Updated to version 2.2.2.  See:
400            http://rubyforge.org/frs/shownotes.php?group_id=627&release_id=26434
401    * json
402          o JSON (JavaScript Object Notation) encoder/decoder
403
404* commandline options
405    * -E, --encoding
406    * -U
407    * --enable-gems, --disable-gems
408    * --enable-rubyopt, --disable-rubyopt
409    * long options are allowed in RUBYOPT environment variable.
410
411=== Implementation changes
412
413* Memory Diet
414    * Object Compaction - Object, Array, String, Hash, Struct, Class,
415      Module
416    * st_table compaction (inlining small tables)
417* YARV
418    * Ruby codes are compiled into opcodes before executed.
419    * Native thread
420
421* Platform supports
422    * Support levels
423          (0) Supported
424          (1) Best effort
425          (2) Perhaps
426          (3) Not supported
427    * Dropped
428          o No longer supports djgpp, bcc32, human68k, MacOS 9 or earlier,
429            VMS nor Windows CE.
430