From: ts Date: 2001-07-03T00:55:37+09:00 Subject: [ruby-talk:17156] Re: RCR: Exception methods (was: Re: Re: keeping an Exception object alive) >>>>> "D" == David Alan Black writes: D> there could be, instead, something like: D> ID array = rb_intern("array"); D> /* ... */ D> if (rb_respond_to(arg, array)) {...} pigeon% grep to_ary *.c array.c:to_ary(ary) array.c: return rb_convert_type(ary, T_ARRAY, "Array", "to_ary"); array.c: ary2 = to_ary(ary2); array.c: y = to_ary(y); array.c: y = to_ary(y); array.c: ary2 = to_ary(ary2); array.c: ary2 = to_ary(ary2); array.c: ary2 = to_ary(ary2); array.c: ary2 = to_ary(ary2); array.c: rb_define_method(rb_cArray, "to_ary", rb_ary_to_a, 0); eval.c:static ID init, eqq, each, aref, aset, match, to_ary; eval.c: if (rb_respond_to(val, to_ary)) { eval.c: VALUE ary = rb_funcall(val, to_ary, 0); eval.c: rb_raise(rb_eTypeError, "%s#to_ary should return Array", eval.c: to_ary = rb_intern("to_ary"); object.c: ID to_ary; object.c: to_ary = rb_intern("to_ary"); object.c: if (rb_respond_to(val, to_ary)) { object.c: val = rb_funcall(val, to_ary, 0); pigeon% Guy Decoux