[#20036] Re: Roundoff problem with Float and Marshal — matz@... (Yukihiro Matsumoto)

まつもと ゆきひろです

16 messages 2003/04/18
[#20045] Re: Roundoff problem with Float and Marshal — nobu.nakada@... 2003/04/20

なかだです。

[#20063] Re: Roundoff problem with Float and Marshal — matz@... (Yukihiro Matsumoto) 2003/04/22

まつもと ゆきひろです

[#20097] jcode.rb — akira yamada / やまだあきら <akira@...>

25 messages 2003/04/26
[#20098] Re: jcode.rb — matz@... (Yukihiro Matsumoto) 2003/04/27

まつもと ゆきひろです

[#20105] Re: jcode.rb — WATANABE Hirofumi <eban@...> 2003/04/28

わたなべです。

[#20108] Re: jcode.rb — matz@... (Yukihiro Matsumoto) 2003/04/28

まつもと ゆきひろです

[ruby-dev:20047] Array#indexes and Array#select

From: WATANABE Hirofumi <eban@...>
Date: 2003-04-20 17:07:09 UTC
List: ruby-dev #20047
わたなべです。

1.8でArray#indexesを使うと
  warning: Array#indexes is deprecated; use Array#select
と言われますが、Array#selectはRangeを受け付けません。
  in `select': cannot convert Range into Integer (TypeError)

後述のパッチのようにすれば受け付けるようになりますが、そもそも
Array#indexesのようにrb_ary_aref()を使わなかったのはなぜでしょうか?

Index: array.c
===================================================================
RCS file: /src/ruby/array.c,v
retrieving revision 1.116
diff -u -1 -r1.116 array.c
--- array.c	10 Apr 2003 09:48:15 -0000	1.116
+++ array.c	20 Apr 2003 17:02:39 -0000
@@ -1191,3 +1191,3 @@
 	for (i=0; i<argc; i++) {
-	    rb_ary_push(result, rb_ary_entry(ary, NUM2LONG(argv[i])));
+	    rb_ary_push(result, rb_ary_aref(1, argv+i, ary));
 	}

In This Thread

Prev Next