diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | array.c | 2 | ||||
-rw-r--r-- | enum.c | 2 | ||||
-rw-r--r-- | eval.c | 28 | ||||
-rw-r--r-- | lib/rss/rss.rb | 4 | ||||
-rw-r--r-- | object.c | 28 |
6 files changed, 13 insertions, 60 deletions
@@ -1,3 +1,12 @@ +Thu Mar 18 15:27:25 2004 Yukihiro Matsumoto <matz@ruby-lang.org> + + * eval.c: remove specialized version of rb_Array(). use simple + one defined in object.c. + + * object.c (Init_Object): remove Kernel#to_a. + + * enum.c (enum_zip): use "to_a" instead of "to_ary". + Wed Mar 17 00:22:03 2004 Kazuo Saito <ksaito@uranus.dti.ne.jp> * oniguruma.h: imported Oniguruma 2.2.5. @@ -915,7 +915,7 @@ rb_ary_to_ary(obj) return obj; } if (rb_respond_to(obj, rb_intern("to_ary"))) { - return rb_convert_type(obj, T_ARRAY, "Array", "to_ary"); + return to_ary(obj); } return rb_ary_new3(1, obj); } @@ -889,7 +889,7 @@ enum_zip(argc, argv, obj) NODE *memo; for (i=0; i<argc; i++) { - argv[i] = rb_convert_type(argv[i], T_ARRAY, "Array", "to_ary"); + argv[i] = rb_convert_type(argv[i], T_ARRAY, "Array", "to_a"); } result = rb_block_given_p() ? Qnil : rb_ary_new(); memo = rb_node_newnode(NODE_MEMO, result, rb_ary_new4(argc, argv), 0); @@ -2598,34 +2598,6 @@ avalue_splat(v) return v; } -#if 1 -VALUE -rb_Array(val) - VALUE val; -{ - VALUE tmp = rb_check_array_type(val); - - if (NIL_P(tmp)) { - /* hack to avoid invoke Object#to_a */ - VALUE origin; - ID id = rb_intern("to_a"); - - if (search_method(CLASS_OF(val), id, &origin) && - RCLASS(origin)->m_tbl != RCLASS(rb_mKernel)->m_tbl) { /* exclude Kernel#to_a */ - val = rb_funcall(val, id, 0); - if (TYPE(val) != T_ARRAY) { - rb_raise(rb_eTypeError, "`to_a' did not return Array"); - } - return val; - } - else { - return rb_ary_new3(1, val); - } - } - return tmp; -} -#endif - static VALUE splat_value(v) VALUE v; diff --git a/lib/rss/rss.rb b/lib/rss/rss.rb index d84b51472d..6386ca3973 100644 --- a/lib/rss/rss.rb +++ b/lib/rss/rss.rb @@ -71,7 +71,7 @@ module RSS class UnknownConversionMethodError < Error attr_reader :to, :from def initialize(to, from) - @to = from + @to = to @from = from super("can't convert to #{to} from #{from}.") end @@ -83,7 +83,7 @@ module RSS attr_reader :string, :to, :from def initialize(string, to, from) @string = string - @to = from + @to = to @from = from super("can't convert #{@string} to #{to} from #{from}.") end @@ -178,7 +178,6 @@ rb_obj_type(obj) return rb_class_real(CLASS_OF(obj)); } - /* * call-seq: * obj.class => class @@ -318,30 +317,6 @@ rb_obj_init_copy(obj, orig) /* * call-seq: - * obj.to_a -> anArray - * - * Returns an array representation of <i>obj</i>. For objects of class - * <code>Object</code> and others that don't explicitly override the - * method, the return value is an array containing <code>self</code>. - * However, this latter behavior will soon be obsolete. - * - * self.to_a #=> -:1: warning: default `to_a' will be obsolete - * "hello".to_a #=> ["hello"] - * Time.new.to_a #=> [39, 54, 8, 9, 4, 2003, 3, 99, true, "CDT"] - */ - - -static VALUE -rb_any_to_a(obj) - VALUE obj; -{ - rb_warn("default `to_a' will be obsolete"); - return rb_ary_new3(1, obj); -} - - -/* - * call-seq: * obj.to_s => string * * Returns a string representing <i>obj</i>. The default @@ -2322,7 +2297,6 @@ rb_f_string(obj, arg) return rb_String(arg); } -#if 0 VALUE rb_Array(val) VALUE val; @@ -2345,7 +2319,6 @@ rb_Array(val) } return tmp; } -#endif /* * call-seq: @@ -2507,7 +2480,6 @@ Init_Object() rb_define_method(rb_mKernel, "freeze", rb_obj_freeze, 0); rb_define_method(rb_mKernel, "frozen?", rb_obj_frozen_p, 0); - rb_define_method(rb_mKernel, "to_a", rb_any_to_a, 0); /* to be removed */ rb_define_method(rb_mKernel, "to_s", rb_any_to_s, 0); rb_define_method(rb_mKernel, "inspect", rb_obj_inspect, 0); rb_define_method(rb_mKernel, "methods", rb_obj_methods, -1); |