From: Yusuke Endoh Date: 2011-10-19T01:04:03+09:00 Subject: [ruby-core:40213] Re: [Ruby 2.0 - Feature #5454] keyword arguments Hello, 2011/10/19 Joshua Ballanco : > For example, should this work: > � � x = 30 > � � def foo(a: 1, b: 2, c: x) > � � � � puts [a, b, c] > � � end > � � foo(a: 10, b: 20) #=> �[10, 20, 30] > ? Though the example will not work because x is in the different variable scope, you can write any expression as a default value, like: def foo(str: File.read("/etc/passwd")) p str end foo(str: "bar") #=> "bar" foo #=> the contents of /etc/passwd ... currently it does not work correctly because of bug of my implementation, though :-) I'll update the patch tomorrow. -- Yusuke Endoh