[#3726] Fixnum#clone and Float#clone raise different exceptions — "David A. Black" <dblack@...>

Hi --

15 messages 2004/11/12
[#3749] Re: Fixnum#clone and Float#clone raise different exceptions — "David A. Black" <dblack@...> 2004/11/16

Hi --

[#3751] Re: Fixnum#clone and Float#clone raise different exceptions — Yukihiro Matsumoto <matz@...> 2004/11/16

Hi,

[#3752] Re: Fixnum#clone and Float#clone raise different exceptions — "David A. Black" <dblack@...> 2004/11/16

Hi --

[#3785] The latest 1.8.2 cvs prints parse error when starting extension compiling — Yukihiro Matsumoto <matz@...>

Hi,

13 messages 2004/11/23
[#3787] Re: The latest 1.8.2 cvs prints parse error when starting extension compiling — Johan Holmberg <holmberg@...> 2004/11/23

Re: [BUG?] convert_type() uses rb_respond_to()

From: Florian Gro<florgro@...>
Date: 2004-11-29 14:13:59 UTC
List: ruby-core #3849
Yukihiro Matsumoto wrote:

> In message "Re: [BUG?] convert_type() uses rb_respond_to()"
>     on Mon, 29 Nov 2004 00:01:01 +0900, Florian Gro<florgro@gmail.com> 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.


In This Thread