aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--array.c2
-rw-r--r--enum.c2
-rw-r--r--eval.c28
-rw-r--r--lib/rss/rss.rb4
-rw-r--r--object.c28
6 files changed, 13 insertions, 60 deletions
diff --git a/ChangeLog b/ChangeLog
index eef6f107b3..e0d373eb65 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/array.c b/array.c
index b309ea044b..058b669a8c 100644
--- a/array.c
+++ b/array.c
@@ -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);
}
diff --git a/enum.c b/enum.c
index cf05219abc..6f69c79737 100644
--- a/enum.c
+++ b/enum.c
@@ -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);
diff --git a/eval.c b/eval.c
index 28f886bf8c..46418a5560 100644
--- a/eval.c
+++ b/eval.c
@@ -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
diff --git a/object.c b/object.c
index bbc9ec5390..0e7801fe77 100644
--- a/object.c
+++ b/object.c
@@ -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);