Removing Array#nitems {}

 Array#nitems はnilã§ãªã„è¦ç´ ã‚’æ•°ãˆã‚‹ãƒ¡ã‚½ãƒƒãƒ‰ã§ã™ãŒã€ãƒ–ãƒ­ãƒƒã‚¯ã‚’
ä¸ŽãˆãŸå ´åˆã¯ãƒ–ãƒ­ãƒƒã‚¯è©•ä¾¡å€¤ãŒçœŸã‚’è¿”ã™ã‚‚ã®ã‚’æ•°ãˆã‚‹ã€ã¨ã„ã†ä»•æ§˜ãŒ
1.9ã§è¿½åŠ ã•ã‚Œã¾ã—ãŸã€‚

ã€€ã—ã‹ã—ã€ã“ã‚Œã¯ãƒ–ãƒ­ãƒƒã‚¯ãªã—ã®å ´åˆã¨ã®é–¢é€£ãŒä»Šã²ã¨ã¤è–„ãã€ã‹ã¤ã€
後からできた Enumerable#count {} と重複します。速度のために
Array#count を用意すれば不要だと思うのですが、いかがでしょうか。

From: “Akinori MUSHA” [email protected]
Subject: [ruby-dev:34676] removing Array#nitems {}
Date: Tue, 13 May 2008 18:06:03 +0900

e$B!!e(BArray#nitems e$B$Oe(Bnile$B$G$J$$MWAG$r?t$($k%a%=%C%I$G$9$,!"%V%m%C%/$re(B
e$BM?$($?>l9g$O%V%m%C%/I>2ACM$,??$rJV$9$b$N$r?t$($k!"$H$$$&;EMM$,e(B
1.9e$B$GDI2C$5$l$^$7$?!#e(B

e$B:G=i!"[email protected]$m$&$H;W$$$^$7$?!#e(B

e$B!!$7$+$7!"$3$l$O%V%m%C%/$J$7$N>l9g$H$N4XO"$,:#$R$H$DGv$/!"$+$D!“e(B
e$B8e$+$i$G$-$?e(B Enumerable#count {} e$B$H=EJ#$7$^$9!#B.EY$N$?$a$Ke(B
Array#count [email protected]$H;W$&$N$G$9$,!”$$$+$,$G$7$g$&$+!#e(B

e$BF10U$7$^$9!#e(B

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:34676] removing Array#nitems {}”
on Tue, 13 May 2008 18:06:03 +0900, “Akinori MUSHA”
[email protected] writes:

|e$B!!e(BArray#nitems e$B$Oe(Bnile$B$G$J$$MWAG$r?t$($k%a%=%C%I$G$9$,!"%V%m%C%/$re(B
|e$BM?$($?>l9g$O%V%m%C%/I>2ACM$,??$rJV$9$b$N$r?t$($k!"$H$$$&;EMM$,e(B
|1.9e$B$GDI2C$5$l$^$7$?!#e(B
|
|e$B!!$7$+$7!"$3$l$O%V%m%C%/$J$7$N>l9g$H$N4XO"$,:#$R$H$DGv$/!"$+$D!“e(B
|e$B8e$+$i$G$-$?e(B Enumerable#count {} e$B$H=EJ#$7$^$9!#B.EY$N$?$a$Ke(B
|Array#count [email protected]$H;W$&$N$G$9$,!”$$$+$,$G$7$g$&$+!#e(B

e$B3NG’$G$9$,!"$3$N!V$$$+$,$G$7$g$&$+!W$Oe(B

  • nitemse$B$r:o=|e(B
  • nitemse$B$,%V%m%C%/$r<u$1IU$1$k$OI,MW$J$$e(B

e$B$N$$$:$l$G$7$g$&$+!#e(B

At Wed, 14 May 2008 12:49:13 +0900,
matz wrote:

In message “Re: [ruby-dev:34676] removing Array#nitems {}”
on Tue, 13 May 2008 18:06:03 +0900, “Akinori MUSHA” [email protected] writes:

| Array#nitems はnilã§ãªã„è¦ç´ ã‚’æ•°ãˆã‚‹ãƒ¡ã‚½ãƒƒãƒ‰ã§ã™ãŒã€ãƒ–ãƒ­ãƒƒã‚¯ã‚’
|ä¸ŽãˆãŸå ´åˆã¯ãƒ–ãƒ­ãƒƒã‚¯è©•ä¾¡å€¤ãŒçœŸã‚’è¿”ã™ã‚‚ã®ã‚’æ•°ãˆã‚‹ã€ã¨ã„ã†ä»•æ§˜ãŒ
|1.9ã§è¿½åŠ ã•ã‚Œã¾ã—ãŸã€‚
|
|ã€€ã—ã‹ã—ã€ã“ã‚Œã¯ãƒ–ãƒ­ãƒƒã‚¯ãªã—ã®å ´åˆã¨ã®é–¢é€£ãŒä»Šã²ã¨ã¤è–„ãã€ã‹ã¤ã€
|後からできた Enumerable#count {} と重複します。速度のために
|Array#count を用意すれば不要だと思うのですが、いかがでしょうか。

 Array#count は先ほど入れました。

確認ですが、この「いかがでしょうか」は

  • nitemsを削除
  • nitemsがブロックを受け付けるは必要ない

 後者です。

 元の Array#nitem の使い道もあまり思いつかないので、 1.9 からは
消してもいいかもしれません。↓こんな話も。

http://jp.rubyist.net/magazine/?0021-Hotlinks

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:34688] Re: removing Array#nitems {}”
on Wed, 14 May 2008 15:03:31 +0900, “Akinori MUSHA”
[email protected] writes:

|e$B!!e(BArray#count [email protected]$[$IF~$l$^$7$?!#e(B
|
|> e$B3NG’$G$9$,!"$3$N!V$$$+$,$G$7$g$&$+!W$Oe(B
|>
|> * nitemse$B$r:o=|e(B
|> * nitemse$B$,%V%m%C%/$r<u$1IU$1$k$OI,MW$J$$e(B
|
|e$B!!8e<T$G$9!#e(B
|
|e$B!!85$Ne(B Array#nitem e$B$N;H$$F;$b$"$^$j;W$$$D$+$J$$$N$G!“e(B 1.9 e$B$+$i$Oe(B
|e$B>C$7$F$b$$$$$+$b$7$l$^$;$s!#”-$3$s$JOC$b!#e(B
|
| http://jp.rubyist.net/magazine/?0021-Hotlinks

e$B$+$o$$$=$&$Je(Bnitemse$B!#@8$_$N?F$K$^$G$=$s$JIw$K;W$o$l$F$k$J$s$Fe(B(e$B>Pe(B
e$B$I$&$7$h!<$+$J$"!#e(B

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev :34689 ] the message: "[ruby-dev:34689] Re: removing
Array#nitems {} ", on May/14 16:11(JST) Yukihiro M. writes:

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

|e$B!!85$Ne(B Array#nitem e$B$N;H$$F;$b$"$^$j;W$$$D$+$J$$$N$G!“e(B 1.9 e$B$+$i$Oe(B
|e$B>C$7$F$b$$$$$+$b$7$l$^$;$s!#”-$3$s$JOC$b!#e(B
| http://jp.rubyist.net/magazine/?0021-Hotlinks

e$B$+$o$$$=$&$Je(Bnitemse$B!#@8$_$N?F$K$^$G$=$s$JIw$K;W$o$l$F$k$J$s$Fe(B(e$B>Pe(B
e$B$I$&$7$h!<$+$J$"!#e(B

e$B;d$N8}$+$i$O$H$F$b:o=|$7$F$/[email protected][email protected]$($J$$$G$9$,e(B(^^;;

__
---------------------------------------------------->> [email protected](B
e$B7=<ye(B <<—
---------------------------------->> e-mail: [email protected] <<—

At Wed, 14 May 2008 16:43:02 +0900,
石塚圭樹 wrote:

まつもと ゆきひろです
(snip)

かわいそうなnitems。生みの親にまでそんな風に思われてるなんて(笑
どうしよーかなあ。

私の口からはとても削除してくださいとは言えないですが(^^;;

 1.8へのバックポートは取り消しました。Array#countも用意したので
あとは一声を待つのみです。 :smiley:

 反対がなければ、いずれひっそりと消しておきますね。

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:34708] Re: removing Array#nitems {}”
on Thu, 15 May 2008 01:15:30 +0900, “Akinori MUSHA”
[email protected] writes:

|> >e$B$+$o$$$=$&$Je(Bnitemse$B!#@8$$N?F$K$^$G$=$s$JIw$K;W$o$l$F$k$J$s$Fe(B(e$B>Pe(B
|> >e$B$I$&$7$h!<$+$J$"!#e(B
|>
|> e$B;d$N8}$+$i$O$H$F$b:o=|$7$F$/[email protected][email protected]$($J$$$G$9$,e(B(^^;;
|
|e$B!!e(B1.8e$B$X$N%P%C%/%]!<%H$O<h$j>C$7$^$7$?!#e(BArray#counte$B$bMQ0U$7$?$N$Ge(B
|e$B$"[email protected]<$rBT$D$N$
$G$9!#e(B :smiley:
|
|e$B!!H?BP$,$J$1$l$P!"$$$:$l$R$C$=$j$H>C$7$F$*$-$^$9$M!#e(B

e$B$(!<$H!"e(B1.8e$B$NHO0OFb$G>C$9$N$O$I$&$J$s$G$7$g$&!#e(B1.9e$B$G$Oe(B…e$B!"e(B
e$B;d$,<+$i0zF3$rEO$7$F$*$-$^$9!#e(B

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs