Skip to content

Instantly share code, notes, and snippets.

@takkanm
Created July 17, 2010 05:48
Show Gist options
  • Save takkanm/479276 to your computer and use it in GitHub Desktop.
Save takkanm/479276 to your computer and use it in GitHub Desktop.
1.8と1.9でstack level too deepのでるタイミングも違う
>> RUBY_VERSION
=> "1.8.7"
>> class Fixnum
>> def add_one(o)
>> self + o + 1
>> end
>> end
=> nil
>> 1 + 1
=> 2
>> class Fixnum
>> def add_one(o)
>> self + o + 1
>> end
>> alias_method "+", "add_one"
>> end
=> Fixnum
>> 1 + 1
(irb):10:in `+': stack level too deep (SystemStackError)
from (irb):10:in `+'
ruby-head > RUBY_VERSION
=> "1.9.3"
ruby-head > class Fixnum
ruby-head ?> def add_one(o)
ruby-head ?> self + o + 1
ruby-head ?> end
ruby-head ?> alias_method "+", "add_one"
ruby-head ?> end
=> Fixnum
(irb):9: stack level too deep (SystemStackError)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment