Yes, but it is still weak. E.g. compare it with Python:
def fun(a, b='bb', *args, **kwargs):
print a, b, args, kwargs
fun(1,2,3,4)
# 1 2 (3, 4) {}
fun(1,2,3, x=11, y=22)
# 1 2 (3,) {'y': 22, 'x': 11}
fun(b=111, a=222)
#222 111 () {}
fun(b=111, a=222, x='blah')
# 222 111 () {'x': 'blah'}
fun(a='aa', c='cc')
# aa bb () {'c': 'cc'}
···
Dnia Tue, 2 Aug 2005 18:24:34 +0900, Neville Burnell napisał(a):
Ruby 1.8 "supports" this coding style however using hashes, for example:
def fun(params)
return "#{params[:a]} #params[:b]"
endPrint fun(:a => 1, :b => 2)
--
JZ