1.9.1-rc2e$B$Ne(BNEWSe$B$NFbMF$K$D$$$F$N%3%a%s%H$H>/$7<ALd$G$9!#e(B
=== Compatibility issues
- language core
New syntax and semantics
o Method used for splat arguments: #to_splat instead of #to_ary
to_splate$B%a%=%C%I$O$J$5$=$&$G$9e(B(r14063e$B$G:o=|e(B?)
o New semantics for constant definition in instance_eval or in module_eval.
(e$B$h$/$o$+$j$^$;$s$G$7$?!#$3$l$K$D$$$F2?$+>pJs$O$"$j$^$;$s$G$7$g$&$+!#e(B)
- builtin classes and objects
- Kernel and Object
o Kernel#methods and #singleton_methods used to return an
array of strings but now they return an array of symbols.
{global,local,instance,class}_valiablese$B$He(Bconstantse$B$b%7%s%%k$rJV$7$^$9!#e(B
* Class and Module o Module#attr is an alias of attr_reader
-we$B$G!Ve(Bwarning: optional boolean argument is obsoletede$B!W$He(B
e$B=P$k$N$G$9$,F0:n<+BN$O=>MhDL$j$N$h$&$G$9!#!Ve(B[Ruby2]e$B!W$G$9$+$Me(B?
* Enumerable and Enumerator
o Enumerable::Enumerator, compatibility alias of Enumerator,
is removed.
aliase$B$H$"$C$F!“e(BEnumerable::Enumerator =
Enumeratore$B$@$C$?$+$h$&$Je(B
e$B0u>]$r<u$1$k$N$G$9$,!”<B:]$K$O$=$&$G$O$J$$$G$9!#e(B
- builtin classes and objects
* IO operations o IO#initialize now accepts an IO argument
ri IOe$B$K$be(BIO.new($stdout)e$B$H$$$&Nc$,$"$k$N$G$9$,!"e(B
e$B<B9T$9$k$H!Ve(Bcan’t convert IO into Integer
(TypeError)e$B!W$H$$$&e(B
e$BNc30$,5/$-$^$9!#e(B
* String and Regexp o No longer an Enumerable
e$B$3$l$Oe(BStringe$B$@$1$G$9$h$M!#e(B
* Symbols: restriction on literal symbols
http://eigenclass.org/hiki/Changes+in+Ruby+1.9#l163e$B$K$h$k$He(B
e$B!Ve(B:$-)e$B!W$N$h$&$JIT@5$J%j%F%i%kI=8=$,$G$-$F$7$^$C$F$$$?e(B
e$B$H$$$&OC$N$h$&$J$N$G$9$,!"3NG’$7$F$_$k$H$=$NF0:n$Oe(B1.8.3e$B$^$G$G!"e(B
1.8.4e$B$G$O!Ve(Bparse error, unexpected ‘)’, expecting
$e$B!W$K$J$j$^$9!#e(B
* Numeric o Numeric#div always rounds as Integer#div has done. o Numeric#fdiv: ditto.
http://eigenclass.org/hiki/Changes+in+Ruby+1.9#l103e$B$K$h$k$He(B
e$B!Ve(B-10.0.div(3)e$B!W!Ve(B-10.div(3)e$B!W$J$I$NCM$,$I$&$J$k$+$H$$$&OC$N$h$&$G$9!#e(B
e$B$3$l$Oe(B1.8.4e$B"*e(B1.8.5e$B$G$9$G$KJQ99$5$l$F$$$^$9!#e(B
* $SAFE and bound methods
e$B4*0c$$$+$b$7$l$J$$$N$G$9$,e(B
http://eigenclass.org/hiki/Changes+in+Ruby+1.9#l164e$B$K$h$k$He(B
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-dev/23697e$B$+$i$N%9%l%C%Ie(B
e$B$N$3$H$+$J$H;W$($^$9!#e(B
e$B$3$l$K$D$$$F$O$=$N8e$N$d$j<h$j$Ge(B1.8.3e$B$"$?$j$KF~$C$?$h$&$G$9!#e(B
o New trusted/untrusted model in addition to tainted/untainted model.
e$B$G!"$3$A$i$Oe(B
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-dev/35306e$B$G$9$M!#e(B
e$B$"$^$jM}2r$G$-$J$$$J$$$+$b$7$l$J$$$N$G$9$1$I!"e(B
(a)$SAFE<=2e$B$G30It$+$iF@$i$l$?%%V%8%'%/%H$He(B
(b)$SAFE>=3e$B$G30It$+$iF@$i$l$?%%V%8%'%/%H$r6hJL$7!“e(B
$SAFE>=4e$B$G$Oe(B(b)e$B$@$1$rJQ99$G$-$k!”$H$$$&$h$&$J$3$H$G$7$g$&$+!#e(B
e$BF0:n>e$Oe(B$SAFE>=4e$B$G$Oe(B
obj.tainted? == truee$B$G$+$De(B
obj.untrusted? == truee$B$G$"$ke(B
e$B%*%V%8%'%/%H$N$_JQ99$G$-$k$H$$$&46$8$G$7$g$&$+!#e(B
* Deprecation
e$BB>$K!Ve(B$=e$B!W$,;H$($J$/$J$C$?$H$$$&$N$b$"$j$=$&$G$9!#e(B
- bundled libraries
=== Language core changes
- New syntax and semantics
o #[] can take splatted arguments, hash style arguments
and a block.
e$B$3$l$Oe(Bhttp://eigenclass.org/hiki/Changes+in+Ruby+1.9#l17e$B$G$7$g$&$+!#e(B
e$B!Ve(BFoo.new[*a, :op => :+]{|x| x
}e$B!W$N$h$&$J=q$-J}$,$G$-$k$H$$$&OC$G$9!#e(B
1.9.1rc2e$B$G$O!Ve(Bfoo[*a,
:b=>1]e$B!W$H$O=q$1$k$h$&$K$J$C$F$$$^$9$,!"e(B
e$B!Ve(Bfoo[1] {|x| …}e$B!W$H$O=q$1$J$$$h$&$G$9!#e(B
e$BB>$K0J2<$,$"$j$=$&$G$9!#e(B
- e$B9TF,!Ve(B.e$B!W$K$h$k9T7QB3e(B
- ENCODING
- def !=e$B!"e(Bdef !~e$B!"e(Bdef !
- ife$B$J$I$G$Ne(Bthene$B$NBe$o$j$Ne(B:
- begine$B!Ae(Bende$B0J30$G$Ne(Bretrye$B$OGQ;_e(B
- evale$B$NBhFs0z?t$H$7$Fe(BProce$B%*%V%8%'%/%H$rEO$;$J$/$J$C$?e(B
=== Library updates
- builtin classes and objects
- Blocks and Procs
o Proc#yield
http://eigenclass.org/hiki/Changes+in+Ruby+1.9#l44e$B$G$7$g$&$+!#e(B
e$B$h$/$o$+$i$J$+$C$?$N$G$9$,e(BProc#calle$B$NJLL>$N$h$&$K8+$($^$9!#e(B
o Passing blocks to #[]
http://eigenclass.org/hiki/Changes+in+Ruby+1.9#l46e$B$@$H;W$$$^$9$,!“e(B
e$B>e$K$b=q$$$?DL$j!”!Ve(Bfoo[] {||}e$B!W$O%(%i!<$K$J$j$^$9!#e(B
* Hash o Hash#_compare_by_identity and Hash#compare_by_identity?
e$B!Ve(BHash#_compare_by_identitye$B!W$Oe(B
e$B!Ve(BHash#compare_by_identitye$B!W$G$7$g$&$+!#e(B
* Symbol o Symbol#=== matches strings
e$B$A$g$C$H$o$+$i$J$+$C$?$N$G$9$,e(B
e$B!Ve(B:s === "s"e$B!W$H$OJL$N$3$H$G$7$g$&$+!#e(B
e$B!Ve(B:s === "s"e$B!W$Oe(Bfalsee$B$G$9!#e(B
* Numeric o Numeric#upto, #downto, #times, #step
uptoe$B!"e(Bdowntoe$B!"e(Btimese$B$Oe(B1.8/1.9e$B$H$b$K$J$/!“e(Bstepe$B$O$I$A$i$K$b$”$j$^$9!#e(B
e$BF0:nJQ$o$C$?$J$I$G$7$g$&$+!#e(B
e$BA4BNE*$K8+$F!“%a%=%C%IL>$@$1=q$+$l$F$$$k$N$Oe(B
e$BDI2C$5$l$?$+JQ99e(B(e$BHs8_49$G$O$J$/5!G=DI2Ce(B?)e$B$,$”$C$?$+e(B
e$B$N$I$A$i$+$N$h$&$G$7$?!#e(B
e$B2DG=$J$i$=$N$I$A$i$+$@$1$G$b$o$+$k$h$&$K$J$C$F$$$k$He(B
e$B$h$$$J$H;W$$$^$7$?!#e(B
e$B0J>e$G$9!#e(B