One feature Ruby sorely lacks is named parameter passing; we want the following behavior:
obj.setprice( apples=20, bananas=30, apricots=40 )
Where the parameters (apples, bananas, etc) may be specified in any order or not at all. The above code does not work in Ruby but we can fake it somewhat using a hash (Ruby 1.8 syntax):
obj.setprice ( :apples [...]
Filed under: metaprogramming, programming, ruby | Tagged: dsl, named parameters, ruby, ruby C API | Leave a Comment »