From: Daniel Luz Date: 2008-12-27T13:55:03+09:00 Subject: [ruby-core:20910] Re: named parameters? I remember reading Matz's slides from 2005 about that: http://www.rubyist.net/~matz/slides/rc2005/mgp00010.html http://www.rubyist.net/~matz/slides/rc2005/mgp00011.html http://www.rubyist.net/~matz/slides/rc2005/mgp00012.html http://www.rubyist.net/~matz/slides/rc2005/mgp00013.html http://www.rubyist.net/~matz/slides/rc2005/mgp00014.html I like his syntax proposition, though I'd prefer something closer to Python's semantics: *args and **kwargs shouldn't repeat information captured elsewhere, i.e., IMHO the "Keyword Arguments (3)" slide should result in: baz() # rest=[],a=4,b=0,keys={} baz(1) # rest=[1],a=4,b=0,keys={} baz(a:1) # rest=[],a=1,b=0,keys={} baz(a:1,b:2) # rest=[],a=1,b=2,keys={} baz(1,2,b:2) # rest=[1,2],a=4,b=2,keys={} baz(c:2) # rest=[],a=4,b=0,keys={c:2} But of course, arguing over them is pointless if they aren't currently in question :) According to the slides, they were originally planned for 1.9. Since they're a pretty big change (see next paragraph), I guess it might be better now to wait for 2.0 than introduce them in a minor release. Named parameters (at least in this form) also have the downside of clashing with implicit Hashes, making the two almost completely incompatible. But I believe a script could be built to rewrite files to turn implicit Hashes into explicit ones, making old code still work (except, of course, for comments, autogenerated code and eval'd strings). In the end, given the huge potential in code clarity and performance gains, I think it's worth the migration pain. Just my two cents. I, too, hope they're added someday. -- Daniel On Fri, Dec 26, 2008 at 23:28, Roger Pack wrote: > Just a curiosity. Are named parameters on the list for anytime? That > would be sweet. > m/b something like > method :a: => value > or something > Thanks! > -=r