In article <3454c9680807010954y78032e71o32fb07f075c7cbc9 / mail.gmail.com>, "Vladimir Sizikov" <vsizikov / gmail.com> writes: > It would be great if all the major versions of MRI would behave > consistently here, > and not throwing the exceptions seems to be the most consistent behavior. > > I'm not 100% sure about 1.9, since it had already released versions, > but definitely for 1.8.8 and further 1.8-line releases, they should > behave as 1.8.6, 1.8.7 heads. I found [ruby-core:12950] (2007-10-26). The change to exception intend to fix "ArgumentError: argument too big" for negative argument. David Flanagan made a patch and matz accept it. No one against it. Now I think returning ary itself is better fix for this problem because it fix the problem AND it is compatible with old behavior. How about this, matz? Index: array.c =================================================================== --- array.c (revision 17784) +++ array.c (working copy) @@ -2141,10 +2141,12 @@ rb_ary_fill(int argc, VALUE *argv, VALUE if (beg < 0) beg = 0; } len = NIL_P(arg2) ? RARRAY_LEN(ary) - beg : NUM2LONG(arg2); - if (len < 0) rb_raise(rb_eIndexError, "negative length (%ld)", len); break; } rb_ary_modify(ary); + if (len < 0) { + return ary; + } if (beg >= ARY_MAX_SIZE || len > ARY_MAX_SIZE - beg) { rb_raise(rb_eArgError, "argument too big"); } -- Tanaka Akira