Project

General

Profile

Bug #10280

Updated by nobu (Nobuyoshi Nakada) about 10 years ago

 
 ~~~ruby ~~~ 
 class DefArg 
   def calc(str, val=val) 
     p val 
   end 
 
   def val 
     10 
   end 
 end 
 
 # ruby-2.2.0-preview1 => nil 
 # ruby-2.1.3            => 10 
 DefArg.new.calc("hello") 
 ~~~ 

 im not sure what ruby spec says. but it looks like this program should print 10 in both the cases. 

Back