2008-12-12 12:42:26 +03:00
|
|
|
= NEWS
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
== Changes since the 1.8.7 release
|
2009-02-12 18:04:41 +03:00
|
|
|
See doc/NEWS-1.8.7 for changes between 1.8.6 and 1.8.7.
|
2008-12-12 12:42:26 +03:00
|
|
|
|
|
|
|
=== Compatibility issues
|
|
|
|
|
|
|
|
* language core
|
|
|
|
|
|
|
|
* New syntax and semantics
|
|
|
|
o Block arguments are always local
|
|
|
|
o New semantics for block arguments
|
|
|
|
o defined? and local variables
|
2009-02-12 18:04:41 +03:00
|
|
|
o Parser expects that your source code has only valid byte
|
|
|
|
sequence in some character encoding. Use magic comments
|
|
|
|
to tell the parser which encoding you use.
|
|
|
|
o New semantics for constant definition in instance_eval
|
|
|
|
or in module_eval.
|
|
|
|
|
|
|
|
* Deprecated syntax
|
|
|
|
o colon (:) instead of "then" in if/unless or case expression.
|
|
|
|
o retry in a loop or an iterator.
|
2008-12-12 12:42:26 +03:00
|
|
|
|
|
|
|
* builtin classes and objects
|
|
|
|
|
|
|
|
* Kernel and Object
|
2009-02-12 18:04:41 +03:00
|
|
|
o Kernel#methods and #singleton_methods used to return an
|
|
|
|
array of strings but now they return an array of symbols.
|
2008-12-12 12:42:26 +03:00
|
|
|
* Class and Module
|
2009-02-12 18:04:41 +03:00
|
|
|
o Module#attr works as Module#attr_reader by default.
|
|
|
|
Optional boolean argument is obsolete.
|
|
|
|
o Module#instance_methods, #private_instance_methods and
|
|
|
|
#public_instance_methods used to return an array of
|
|
|
|
strings but now they return an array of symbols.
|
2008-12-12 12:42:26 +03:00
|
|
|
o Extra subclassing check when binding UnboundMethods
|
2009-02-12 18:04:41 +03:00
|
|
|
|
2008-12-12 12:42:26 +03:00
|
|
|
* Exceptions
|
2009-02-12 18:04:41 +03:00
|
|
|
o Exceptions are equal to each other if they belong to
|
|
|
|
the same class and have the same message and backtrace.
|
|
|
|
o SystemStackError used to be a subclass of StandardError
|
|
|
|
but not it is a direct subclass of Exception.
|
|
|
|
o SecurityError: ditto
|
2008-12-12 12:42:26 +03:00
|
|
|
o Removed Exception#to_str [Ruby2]
|
|
|
|
|
2009-02-12 18:04:41 +03:00
|
|
|
* Enumerable and Enumerator
|
|
|
|
o Enumerable::Enumerator, compatibility alias of Enumerator,
|
|
|
|
is removed.
|
|
|
|
o Enumerable#{map,collect} called without a block returns
|
|
|
|
an enumerator.
|
|
|
|
o Even more builtin and bundled libraries have been made to
|
|
|
|
return an enumerator when called without a block.
|
2008-12-12 12:42:26 +03:00
|
|
|
* Array
|
|
|
|
o Array#nitems was removed (use count {|i| !i.nil?})
|
|
|
|
o Array#choice was removed (use sample)
|
|
|
|
o Array#[m,n] = nil places nil in the array.
|
|
|
|
* Hash
|
|
|
|
o Hash#to_s is equivalent to Hash#inspect
|
|
|
|
o Semantics for Hash#each and Hash#each_pair
|
|
|
|
o Hash#select returns a hash
|
2009-02-12 18:04:41 +03:00
|
|
|
o Hash#key is the new name for #index which has been
|
|
|
|
deprecated.
|
|
|
|
o Hash preserves order. It enumerates its elements in the
|
|
|
|
order in which the keys are inserted.
|
|
|
|
o Most of the changes in Hash apply to hash like interfaces
|
|
|
|
such as ENV and *DBM.
|
2008-12-12 12:42:26 +03:00
|
|
|
* IO operations
|
2009-02-12 18:04:41 +03:00
|
|
|
o Many methods used to act byte-wise but now some of those act
|
|
|
|
character-wise. You can use alternate byte-wise methods.
|
2008-12-12 12:42:26 +03:00
|
|
|
o IO#getc
|
|
|
|
o Non-blocking IO
|
|
|
|
o Kernel#open takes "t" for newline conversion
|
|
|
|
o Kernel#open takes encoding specified
|
2009-02-12 18:04:41 +03:00
|
|
|
o IO automatically converts byte sequence from a character
|
|
|
|
encodings into another if specified.
|
2008-12-12 12:42:26 +03:00
|
|
|
o StringIO#readpartial
|
|
|
|
o IO.try_convert
|
2009-02-12 18:04:41 +03:00
|
|
|
o IO.binread
|
|
|
|
o IO.copy_stream
|
|
|
|
o IO#binmode?
|
|
|
|
o IO#close_on_exec= and IO#close_on_exec?
|
|
|
|
o Limit input in IO#gets, IO#readline, IO#readlines,
|
|
|
|
IO#each_line, IO#lines, IO.foreach, IO.readlines,
|
|
|
|
StringIO#gets, StringIO#readline, StringIO#each,
|
|
|
|
StringIO#readlines
|
2008-12-12 12:42:26 +03:00
|
|
|
o IO#ungetc, StringIO#ungetc
|
2009-02-12 18:04:41 +03:00
|
|
|
o IO#ungetbyte, StringIO#ungetbyte
|
|
|
|
o IO#internal_encoding, IO#external_encoding,
|
|
|
|
IO#set_encoding
|
|
|
|
o IO.pipe takes encoding option
|
|
|
|
o Directive %u behaves like %d for negative values in
|
|
|
|
printf-style formatting.
|
|
|
|
* File and Dir operations
|
|
|
|
o #to_path is called as necessary in File.path, File.chmod,
|
|
|
|
File.lchmod, File.chown, File.lchown, File.utime,
|
|
|
|
File.unlink, etc..
|
|
|
|
o File.world_readable?
|
|
|
|
o File.world_writable?
|
|
|
|
o Dir.[], Dir.glob
|
|
|
|
o Dir.exist?
|
|
|
|
o Dir.exists?
|
|
|
|
* File::Stat
|
|
|
|
o File::Stat#world_readable?
|
|
|
|
o File::Stat#world_writable?
|
|
|
|
* String
|
|
|
|
o No longer an Enumerable: use each_line/lines for line
|
|
|
|
oriented operation
|
|
|
|
o Encoding-awareness
|
|
|
|
o Character-wise semantics in many methods instead of
|
|
|
|
byte-wise.
|
|
|
|
o String#[]: Indexing a String with an integer returns a
|
|
|
|
single character String instead of an integer.
|
|
|
|
o String#[]=: No longer takes an integer as right
|
|
|
|
side value. Note that "str[i] = ?c" because of
|
|
|
|
the following change.
|
|
|
|
o ?c is evaluated to a single character string
|
|
|
|
instead of an integer.
|
|
|
|
* Regexp
|
|
|
|
o Encoding-awareness
|
|
|
|
o Regexp matches only with strings which is encoded in a
|
|
|
|
compatible character encoding to the regexp's.
|
|
|
|
o Regexp#kcode is removed. use Regexp#encoding.
|
|
|
|
* Symbols: restriction on literal symbols
|
|
|
|
* Numeric
|
|
|
|
o Numeric#div always rounds as Integer#div has done.
|
|
|
|
o Numeric#fdiv: ditto.
|
|
|
|
* Integer
|
|
|
|
o Integer(nil) raises TypeError
|
|
|
|
* Fixnum
|
|
|
|
o Fixnum#id2name removed
|
|
|
|
o Fixnum#to_sym removed
|
|
|
|
* Struct
|
|
|
|
o Struct#inspect
|
2008-12-12 12:42:26 +03:00
|
|
|
* Time
|
|
|
|
o New format in Time#to_s
|
|
|
|
o Timezone information preserved on Marshal.dump/load
|
|
|
|
* $SAFE and bound methods
|
2009-02-12 18:04:41 +03:00
|
|
|
o New trusted/untrusted model in addition to
|
|
|
|
tainted/untainted model.
|
|
|
|
|
2008-12-12 12:42:26 +03:00
|
|
|
* Deprecation
|
2009-02-12 18:04:41 +03:00
|
|
|
o $= (global flag for case-sensitiveness on string matching)
|
|
|
|
o Kernel#to_a
|
|
|
|
o Kernel#getc, #gsub, #sub
|
|
|
|
o Kernel#callcc and Continuation now become 'continuation'
|
|
|
|
bundled library.
|
2008-12-12 12:42:26 +03:00
|
|
|
o Object#type
|
2009-02-12 18:04:41 +03:00
|
|
|
o Removed Array and Hash #indices, #indexes
|
2008-12-12 12:42:26 +03:00
|
|
|
o Hash#index
|
|
|
|
o ENV.index
|
2009-02-12 18:04:41 +03:00
|
|
|
o Process::Status#to_int
|
|
|
|
o Numeric#rdiv
|
|
|
|
o Precision is removed. Don't cry, it will be redesigned
|
|
|
|
and come back in future version.
|
|
|
|
o Symbol#to_int and Symbol#to_i
|
|
|
|
o $KCODE is no longer effective. Use Encoding related
|
|
|
|
features of each class.
|
|
|
|
o VERSION and friends
|
2008-12-12 12:42:26 +03:00
|
|
|
|
|
|
|
* bundled libraries
|
|
|
|
|
2009-02-12 18:04:41 +03:00
|
|
|
* Pathname
|
|
|
|
o No longer has #to_str nor #=~.
|
|
|
|
* time and date
|
|
|
|
o Time.parse and Date.parse interprets slashed numerical dates
|
|
|
|
as "dd/mm/yyyy".
|
2008-12-12 12:42:26 +03:00
|
|
|
* Readline
|
2009-02-12 18:04:41 +03:00
|
|
|
o If Readline uses libedit, Readline::HISTORY[0] returns the
|
|
|
|
first of the history.
|
|
|
|
* Continuation
|
|
|
|
o as above
|
|
|
|
|
|
|
|
* Deprecation
|
|
|
|
o Complex#image: use Complex#imag
|
|
|
|
o All SSL-related class methods in Net::SMTP
|
|
|
|
o Prime#cache, Prime#primes, Prime#primes_so_far
|
|
|
|
o mailread library: use tmail gem.
|
|
|
|
o cgi-lib library: use cgi.
|
|
|
|
o date2 library: use date.
|
|
|
|
o eregex library
|
|
|
|
o finalize library: use ObjectSpace.define_finalizer if you
|
|
|
|
really need a finalizer. really?
|
|
|
|
o ftools library: use fileutils.
|
|
|
|
o generator library: use Enumerator.
|
|
|
|
o importenv library and Env library
|
|
|
|
o jcode library: use multilingualization support of String
|
|
|
|
o parsedate library
|
|
|
|
o ping library
|
|
|
|
o readbytes library
|
|
|
|
o getopts library and parsearg library: use optparse or
|
|
|
|
getoptlong.
|
|
|
|
o soap, wsdl and xsd libraries: use soap4r gem.
|
|
|
|
o Win32API library: use dl.
|
|
|
|
o dl library: Reimplemented and API changed. use the new
|
|
|
|
version of dl or ffi gem.
|
|
|
|
o rubyunit library and runit library: use minitest or
|
|
|
|
test/unit. Or use anything you love through RubyGems.
|
|
|
|
o test/unit is reimplemented on top of minitest. This is
|
|
|
|
not fully compatible with the original.
|
2008-12-12 12:42:26 +03:00
|
|
|
|
|
|
|
=== Language core changes
|
|
|
|
|
|
|
|
* New syntax and semantics
|
2009-02-12 18:04:41 +03:00
|
|
|
o Magic comments to declare in which encoding your source
|
|
|
|
code is written
|
|
|
|
o New literal hash syntax and new syntax for hash style
|
|
|
|
arguments
|
2008-12-12 12:42:26 +03:00
|
|
|
o New syntax for lambdas
|
|
|
|
o .() and calling Procs without #call/#[]
|
2009-02-12 18:04:41 +03:00
|
|
|
o Block in block arguments
|
|
|
|
o Block local variables
|
2008-12-12 12:42:26 +03:00
|
|
|
o Mandatory arguments after optional arguments allowed
|
|
|
|
o Multiple splats allowed
|
2009-02-12 18:04:41 +03:00
|
|
|
o #[] can take splatted arguments, hash style arguments
|
|
|
|
and a block.
|
|
|
|
o New directives in printf-style formatted strings (%).
|
|
|
|
o Newlines allowed before ternary colon operator (:) and
|
|
|
|
method call dot operator (.)
|
|
|
|
o Negative operators such as !, != and !~ are now
|
|
|
|
overloadable
|
|
|
|
o Encoding.default_external and default_internal
|
|
|
|
o __ENCODING__: New pseudo variable to hold the current
|
|
|
|
script's encoding
|
2008-12-12 12:42:26 +03:00
|
|
|
|
|
|
|
=== Library updates
|
|
|
|
|
2009-02-12 18:04:41 +03:00
|
|
|
* builtin classes and objects
|
2008-12-12 12:42:26 +03:00
|
|
|
* Kernel and Object
|
|
|
|
o BasicObject
|
2009-02-12 18:04:41 +03:00
|
|
|
o Object#=~ returns nil instead of false by default.
|
2008-12-12 12:42:26 +03:00
|
|
|
o Kernel#define_singleton_method
|
2009-02-12 18:04:41 +03:00
|
|
|
o Kernel#load can load a library from the highest versions
|
|
|
|
of gems by default.
|
2008-12-12 12:42:26 +03:00
|
|
|
* Class and Module
|
|
|
|
o Module#const_defined?, #const_get and #method_defined?
|
2009-02-12 18:04:41 +03:00
|
|
|
take an optional parameter.
|
|
|
|
o #class_variable_{set,get} are public.
|
2008-12-12 12:42:26 +03:00
|
|
|
o Class of singleton classes
|
2009-02-12 18:04:41 +03:00
|
|
|
|
|
|
|
* Errno::EXXX
|
|
|
|
o All of those are always defined. Errno::EXXX will be
|
|
|
|
defined as an alias to Errno::NOERROR if your platform
|
|
|
|
does not have one.
|
|
|
|
|
2008-12-12 12:42:26 +03:00
|
|
|
* Binding#eval
|
|
|
|
* Blocks and Procs
|
|
|
|
o Arity of blocks without arguments
|
|
|
|
o proc is now a synonym of Proc.new
|
|
|
|
o Proc#yield
|
|
|
|
o Passing blocks to #[]
|
|
|
|
o Proc#lambda?
|
2009-02-12 18:04:41 +03:00
|
|
|
o Proc#curry
|
|
|
|
* Fiber: coroutines/micro-threads
|
|
|
|
* Thread
|
|
|
|
o Thread.critical and Thread.critical= removed
|
|
|
|
o Thread#exit!, Thread#kill! and Thread#terminate! removed.
|
|
|
|
|
2008-12-12 12:42:26 +03:00
|
|
|
* Enumerable and Enumerator
|
2009-02-12 18:04:41 +03:00
|
|
|
o Enumerator#enum_cons and Enumerator#enum_slice are
|
|
|
|
removed. Use #each_cons and #each_slice without a block.
|
|
|
|
o Enumerable#each_with_index can take optional arguments
|
|
|
|
and passes them to #each.
|
|
|
|
o Enumerable#each_with_object
|
2008-12-12 12:42:26 +03:00
|
|
|
o Enumerator#with_object
|
|
|
|
o Enumerator.new { ... }
|
|
|
|
* Array
|
|
|
|
o Array#delete returns a deleted element rather than a given
|
|
|
|
object
|
|
|
|
o Array#to_s is equivalent to Array#inspect
|
|
|
|
o Array.try_convert
|
2009-02-12 18:04:41 +03:00
|
|
|
o Array#pack('m0') complies with RFC 4648.
|
2008-12-12 12:42:26 +03:00
|
|
|
* Hash
|
|
|
|
o preserving item insertion order
|
|
|
|
o Hash#default_proc=
|
|
|
|
o Hash#_compare_by_identity and Hash#compare_by_identity?
|
|
|
|
o Hash.try_convert
|
2009-02-12 18:04:41 +03:00
|
|
|
o Hash#assoc
|
|
|
|
o Hash#rassoc
|
|
|
|
o Hash#flatten
|
2008-12-12 12:42:26 +03:00
|
|
|
* Range
|
|
|
|
o Range#cover?
|
|
|
|
o Range#include? iterates over elements and compares the
|
|
|
|
given value with each element unless the range is numeric.
|
|
|
|
Use Range#cover? for the old behavior, i.e. comparison
|
|
|
|
with boundary values.
|
|
|
|
o Range#min, Range#max
|
2009-02-12 18:04:41 +03:00
|
|
|
|
|
|
|
* File and Dir operations
|
|
|
|
o New methods
|
|
|
|
* Process
|
|
|
|
o Process.spawn
|
|
|
|
o Process.daemon
|
2008-12-12 12:42:26 +03:00
|
|
|
* String
|
|
|
|
o String#clear
|
|
|
|
o String#ord
|
|
|
|
o String#getbyte, String#setbyte
|
2009-02-12 18:04:41 +03:00
|
|
|
o String#chars and String#each_char act as character-wise.
|
|
|
|
o String#codepoints, String#each_codepoint
|
2008-12-12 12:42:26 +03:00
|
|
|
o String#unpack with a block
|
|
|
|
o String#hash
|
|
|
|
o String.try_convert
|
2009-02-12 18:04:41 +03:00
|
|
|
o String#encoding
|
|
|
|
o String#force_encoding, String#encode and String#encode!
|
|
|
|
o String#ascii_only?
|
|
|
|
o String#valid_encoding?
|
|
|
|
o String#match
|
2008-12-12 12:42:26 +03:00
|
|
|
* Symbol
|
|
|
|
o Zero-length symbols allowed
|
|
|
|
o Symbol#intern
|
|
|
|
o Symbol#encoding
|
|
|
|
o Symbol methods similar to those in String
|
2009-02-12 18:04:41 +03:00
|
|
|
* Regexp
|
|
|
|
o Regexp#=== matches symbols
|
|
|
|
o Regexp.try_convert
|
|
|
|
o Regexp#match
|
|
|
|
o Regexp#fixed_encoding?
|
|
|
|
o Regexp#encoding
|
|
|
|
o Regexp#named_captures
|
|
|
|
o Regexp#names
|
|
|
|
* MatchData
|
|
|
|
o MatchData#names
|
|
|
|
o MatchData#regexp
|
|
|
|
* Encoding
|
|
|
|
* Encoding::Converter
|
|
|
|
o supports conversion between many encodings
|
|
|
|
* Numeric
|
|
|
|
o Numeric#upto, #downto, #times, #step
|
|
|
|
o Numeric#real?, Complex#real?
|
|
|
|
o Numeric#magnitude
|
|
|
|
* Rational / Complex
|
|
|
|
o They are in the core library now
|
2008-12-12 12:42:26 +03:00
|
|
|
* Math
|
2009-02-12 18:04:41 +03:00
|
|
|
o Math#log takes an optional argument.
|
|
|
|
o Math#log2
|
|
|
|
o Math#cbrt, Math#lgamma, Math#gamma
|
|
|
|
* Time
|
|
|
|
o Time.times removed. Use Process.times.
|
|
|
|
o Time#sunday?
|
|
|
|
o Time#monday?
|
|
|
|
o Time#tuesday?
|
|
|
|
o Time#wednesday?
|
|
|
|
o Time#thursday?
|
|
|
|
o Time#friday?
|
|
|
|
o Time#saturday?
|
|
|
|
o Time#tv_nsec and Time#nsec
|
2008-12-12 12:42:26 +03:00
|
|
|
* Misc. new methods
|
2009-02-12 18:04:41 +03:00
|
|
|
o RUBY_ENGINE to distinguish between Ruby processor implementation
|
|
|
|
o public_method
|
2008-12-12 12:42:26 +03:00
|
|
|
o public_send
|
|
|
|
o GC.count
|
|
|
|
o ObjectSpace.count_objects
|
|
|
|
o Method#hash, Proc#hash
|
2009-02-12 18:04:41 +03:00
|
|
|
o Method#source_location, UnboundMethod#source_location and
|
|
|
|
Proc#source_location
|
2008-12-12 12:42:26 +03:00
|
|
|
o __callee__
|
2009-02-12 18:04:41 +03:00
|
|
|
o Elements in $LOAD_PATH and $LOADED_FEATURES are expanded
|
|
|
|
|
|
|
|
* bundled libraries
|
|
|
|
* RubyGems
|
|
|
|
o Package management system for Ruby.
|
|
|
|
o Integrated with Ruby's library loader.
|
|
|
|
* Rake
|
|
|
|
o Ruby make. A simple ruby build program with capabilities
|
|
|
|
similar to make.
|
|
|
|
* minitest
|
|
|
|
o Our new testing library which is faster, cleaner and easier
|
|
|
|
to read than the old test/unit.
|
|
|
|
o You can introduce the old test/unit as testunit gem through
|
|
|
|
RubyGems if you want.
|
|
|
|
* CMath
|
|
|
|
o Complex number version of Math
|
|
|
|
* Prime
|
|
|
|
o Extracted from Mathn and improved. You can easily enumerate
|
|
|
|
prime numbers.
|
|
|
|
o Prime.new is obsolete. Use its class methods.
|
|
|
|
* ripper
|
|
|
|
o Ruby script parser
|
|
|
|
* Readline
|
|
|
|
o Readline.vi_editing_mode?
|
|
|
|
o Readline.emacs_editing_mode?
|
|
|
|
o Readline::HISTORY.clear
|
|
|
|
* Tk
|
|
|
|
o TkXXX widget classes are removed and redefined as aliases of
|
|
|
|
Tk::XXX classes.
|
|
|
|
* RDoc
|
|
|
|
o Updated to version 2.2.2. See:
|
|
|
|
http://rubyforge.org/frs/shownotes.php?group_id=627&release_id=26434
|
2010-07-14 14:04:02 +04:00
|
|
|
* json
|
|
|
|
o JSON (JavaScript Object Notation) encoder/decoder
|
2009-02-12 18:04:41 +03:00
|
|
|
|
|
|
|
* commandline options
|
|
|
|
* -E, --encoding
|
|
|
|
* -U
|
|
|
|
* --enable-gems, --disable-gems
|
|
|
|
* --enable-rubyopt, --disable-rubyopt
|
|
|
|
* long options are allowed in RUBYOPT environment variable.
|
2008-12-12 12:42:26 +03:00
|
|
|
|
|
|
|
=== Implementation changes
|
|
|
|
|
2009-02-12 18:04:41 +03:00
|
|
|
* Memory Diet
|
|
|
|
* Object Compaction - Object, Array, String, Hash, Struct, Class,
|
|
|
|
Module
|
|
|
|
* st_table compaction (inlining small tables)
|
|
|
|
* YARV
|
|
|
|
* Ruby codes are compiled into opcodes before executed.
|
|
|
|
* Native thread
|
|
|
|
|
|
|
|
* Platform supports
|
|
|
|
* Support levels
|
|
|
|
(0) Supported
|
|
|
|
(1) Best effort
|
|
|
|
(2) Perhaps
|
|
|
|
(3) Not supported
|
|
|
|
* Dropped
|
|
|
|
o No longer supports djgpp, bcc32, human68k, MacOS 9 or earlier,
|
|
|
|
VMS nor Windows CE.
|