# Is it bug?

**URL:** <https://www.ruby-forum.com/t/is-it-bug/109747>\
**Category:** Ruby\
**Created:** [July 18, 2007, 4:00pm UTC](https://www.ruby-forum.com/t/is-it-bug/109747 "2007-07-18T16:00:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkeh12](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/7993a0/32.png) [@bkeh12](https://www.ruby-forum.com/u/bkeh12)\
**Post date:** [July 18, 2007, 4:00pm UTC](https://www.ruby-forum.com/t/is-it-bug/109747/1 "2007-07-18T16:00:50Z")

</div>

Hi, all  
[root@home1 ~]# ruby -v  
ruby 1.9.0 (2007-06-30 patchlevel 0) [i686-linux]  
[root@home1 ~]# irb  
irb(main):001:0\> class C  
irb(main):002:1\> def C.hello  
irb(main):003:2\> p “helloc”  
irb(main):004:2\> end  
irb(main):005:1\> end  
=\> nil  
irb(main):006:0\> class A \< C  
irb(main):007:1\> def A.hello  
irb(main):008:2\> p “C #{hello}”  
irb(main):009:2\> end  
irb(main):010:1\> hello  
irb(main):011:1\> end  
(irb):8:in `hello': stack level too deep (SystemStackError) from (irb):8:in`hello’  
from (irb):8:in `hello' from (irb):8:in`hello’  
from (irb):8:in `hello' from (irb):8:in`hello’  
from (irb):8:in `hello' from (irb):8:in`hello’  
from (irb):8:in `hello’  
… 6881 levels…

---

<div class="post-metadata">

**Author:** ![bkeh12](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/7993a0/32.png) [@bkeh12](https://www.ruby-forum.com/u/bkeh12)\
**Post date:** [July 18, 2007, 4:02pm UTC](https://www.ruby-forum.com/t/is-it-bug/109747/2 "2007-07-18T16:02:59Z")

</div>

Chung C. wrote:

> Hi, all  
> [root@home1 ~]# ruby -v  
> ruby 1.9.0 (2007-06-30 patchlevel 0) [i686-linux]  
> [root@home1 ~]# irb  
> irb(main):001:0\> class C  
> irb(main):002:1\> def C.hello  
> irb(main):003:2\> p “helloc”  
> irb(main):004:2\> end  
> irb(main):005:1\> end  
> =\> nil  
> irb(main):006:0\> class A \< C  
> irb(main):007:1\> def A.hello  
> irb(main):008:2\> p “C #{hello}”  
> irb(main):009:2\> end  
> irb(main):010:1\> hello  
> irb(main):011:1\> end

It is not a bug. You recursively call A.hello. You want:  
p “C #{super}”

Regards  
Stefan

---

<div class="post-metadata">

**Author:** ![bkeh12](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/7993a0/32.png) [@bkeh12](https://www.ruby-forum.com/u/bkeh12)\
**Post date:** [July 18, 2007, 4:44pm UTC](https://www.ruby-forum.com/t/is-it-bug/109747/3 "2007-07-18T16:44:15Z")

</div>

Quoting Chung C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> irb(main):006:0\> class A \< C  
> from (irb):8:in `hello' from (irb):8:in `hello’  
> from (irb):8:in `hello' from (irb):8:in `hello’  
> … 6881 levels…

Why would you consider this a bug? What on earth were you expecting  
it to do? You define a method with no arguments that always calls  
itself, and then you call it, and ruby complains from the infinite  
recursion.

What else would you have it do?

---

<div class="post-metadata">

**Author:** ![bkeh12](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/7993a0/32.png) [@bkeh12](https://www.ruby-forum.com/u/bkeh12)\
**Post date:** [July 19, 2007, 5:10pm UTC](https://www.ruby-forum.com/t/is-it-bug/109747/4 "2007-07-19T17:10:54Z")

</div>

Daniel M. wrote:

> What else would you have it do?

I hope ruby can contextual valid…🙂
