# What's going on here? (weird Ruby 1.9 incompatibility)

**URL:** <https://www.ruby-forum.com/t/whats-going-on-here-weird-ruby-1-9-incompatibility/133284>\
**Category:** Ruby\
**Created:** [March 29, 2008, 7:09pm UTC](https://www.ruby-forum.com/t/whats-going-on-here-weird-ruby-1-9-incompatibility/133284 "2008-03-29T19:09:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![murfhy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@murfhy](https://www.ruby-forum.com/u/murfhy)\
**Post date:** [March 29, 2008, 7:09pm UTC](https://www.ruby-forum.com/t/whats-going-on-here-weird-ruby-1-9-incompatibility/133284/1 "2008-03-29T19:09:26Z")

</div>

class A  
def a  
‘yay’  
end  
end

class B  
def initialize(&meth)  
class \<\< self; self; end. **send** (:define\_method, :b, &meth)  
end  
end

b = B.new &A.new.method(:a)  
p b.b

Ruby 1.8 prints:  
“yay”

Ruby 1.9 complains (on the p b.b line):  
14:in `’: wrong number of arguments (1 for 0) (ArgumentError)

---

<div class="post-metadata">

**Author:** ![murfhy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@murfhy](https://www.ruby-forum.com/u/murfhy)\
**Post date:** [March 29, 2008, 8:49pm UTC](https://www.ruby-forum.com/t/whats-going-on-here-weird-ruby-1-9-incompatibility/133284/2 "2008-03-29T20:49:46Z")

</div>

On Sat, Mar 29, 2008 at 12:08 PM, Tony A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Ruby 1.8 prints:  
> “yay”
> 
> Ruby 1.9 complains (on the p b.b line):  
> 14:in `': wrong number of arguments (1 for 0) (ArgumentError)

I tried changing A to have the following definition:

class A  
def a(\*args)  
args  
end  
end

Now:

Ruby 1.8:  
[]

or if you call b.b(1,2,3):  
[1,2,3]

Ruby 1.9:  
[nil]

or if you call b.b(1,2,3):  
[1]

Is this a bug?

---

<div class="post-metadata">

**Author:** ![murfhy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@murfhy](https://www.ruby-forum.com/u/murfhy)\
**Post date:** [March 29, 2008, 9:09pm UTC](https://www.ruby-forum.com/t/whats-going-on-here-weird-ruby-1-9-incompatibility/133284/3 "2008-03-29T21:09:56Z")

</div>

On Sat, Mar 29, 2008 at 7:08 PM, Tony A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ## end
> 
> Tony A.  
> [medioh.com](http://medioh.com)

I added the output of the arity of the methods, looks very much like a  
bug to me, are you familiar with the Bug Reporting process?

`
ma = A.new.method(:a)
p ma.arity # --> 0
b = B.new( &ma )
mb = b.method(:b)
p mb.arity # --> 0
`

`p b.b # bombs
`

## Cheers Robert

[http://ruby-smalltalk.blogspot.com/](http://ruby-smalltalk.blogspot.com/)

* * *

Whereof one cannot speak, thereof one must be silent.  
Ludwig Wittgenstein

---

<div class="post-metadata">

**Author:** ![murfhy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@murfhy](https://www.ruby-forum.com/u/murfhy)\
**Post date:** [March 31, 2008, 8:31am UTC](https://www.ruby-forum.com/t/whats-going-on-here-weird-ruby-1-9-incompatibility/133284/4 "2008-03-31T08:31:12Z")

</div>

Hi,

In message “Re: What’s going on here? (weird Ruby 1.9 incompatibility)”  
on Sun, 30 Mar 2008 22:38:37 +0900, ts [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
writes:

|Tony A. wrote:  
|\> Is this a bug?  
|  
| Yes, can you submit it ?

You don’t have to. I just fixed, and am going to commit soon between  
EURUKO sessions.

```
          matz.

```

---

<div class="post-metadata">

**Author:** ![murfhy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@murfhy](https://www.ruby-forum.com/u/murfhy)\
**Post date:** [March 30, 2008, 3:38pm UTC](https://www.ruby-forum.com/t/whats-going-on-here-weird-ruby-1-9-incompatibility/133284/5 "2008-03-30T15:38:59Z")

</div>

Tony A. wrote:

> Is this a bug?

Yes, can you submit it ?

Go to

[http://rubyforge.org/tracker/?func=browse&group\_id=426&atid=1698](http://rubyforge.org/tracker/?func=browse&group_id=426&atid=1698)

and create a new entry with your example.

Guy Decoux

---

<div class="post-metadata">

**Author:** ![murfhy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@murfhy](https://www.ruby-forum.com/u/murfhy)\
**Post date:** [April 10, 2008, 3:08am UTC](https://www.ruby-forum.com/t/whats-going-on-here-weird-ruby-1-9-incompatibility/133284/6 "2008-04-10T03:08:58Z")

</div>

On Mon, Mar 31, 2008 at 12:28 AM, Yukihiro M.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> You don’t have to. I just fixed, and am going to commit soon between  
> EURUKO sessions.

Excellent, thank you!

---

<div class="post-metadata">

**Author:** ![murfhy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@murfhy](https://www.ruby-forum.com/u/murfhy)\
**Post date:** [March 31, 2008, 10:25am UTC](https://www.ruby-forum.com/t/whats-going-on-here-weird-ruby-1-9-incompatibility/133284/7 "2008-03-31T10:25:17Z")

</div>

Yukihiro M. wrote:

> You don’t have to. I just fixed, and am going to commit soon between  
> EURUKO sessions.

Why not do the same with is\_from\_method ?

Guy Decoux
