From: Tim Hunter Date: 2004-10-23T08:24:13+09:00 Subject: Re: Too many default argument values! GGarramuno wrote: > > However, where this approach is of not much use is on some method > invocation that requires a long list of optional parameters. Creating > a new object and filling its data just for calling an instance's > method still feels too much C like and awkward. > That's still one thing where named parameters built into the language > seem like a good idea and one thing that I do miss from python. I actually used a very similar approach in RMagick, where many of the methods have a very long list of optional parameters. I had just about decided to split the `rect' method into two methods, one for square-cornered rectangles and one for round-cornered rectangles, but then I saw that I was going to have to do something with _this_ monster, a sibling method to `rect': def text(text, x, y, dx, dy, rotate, styles) # blah, blah blah end Here the last 6 arguments are optional! Since I want to use a consistent style among all these methods, I need to choose a solution for `text' and use it for `rect' as well. The simplest thing to do would be to (as other people have suggested) put the optional arguments in with the `style' hash, but I'm reluctant to mix both style and non-style arguments like that. Back to the drawing board. I'm going to review all the suggestions in this thread for illumination and advice.