From: "Florian Groß" Date: 2004-11-29T23:13:59+09:00 Subject: Re: [BUG?] convert_type() uses rb_respond_to() Yukihiro Matsumoto wrote: > In message "Re: [BUG?] convert_type() uses rb_respond_to()" > on Mon, 29 Nov 2004 00:01:01 +0900, Florian Gro� writes: > > |> I think so. My opinion is that "respond_to?" of proxy object should > |> be overridden to delegate unknown method names to the remote object, > |> when method_missing is used extensively. > | > |This sounds good -- so convert_type() should basically use > |RTEST(rb_funcall(val, rb_intern("respond_to?"), 1, ID2SYM(m))) instead > |of directly using rb_respond_to? > > Wait, I have forgotten one factor: performance. > > I just remembered that I wanted to avoid capturing exception by using > rb_respond_to(). Since rb_funcall() is much slower than capturing, > I'd call "to_ary" directly. > > respond_to? method should check remote object anyway. Hm, so will this be changed so that Ruby uses duck-typing in this case? (i.e. just calling the method and raising a different exception instead of using rb_respond_to()) Or am I misunderstanding and this issue should be solved by manually adding .to_ary, .to_int and so on to proxy Objects? (so that the rb_respond_to() check succeeds) Sorry that I make this that long a thread. I fear I'm misunderstanding.