From: Curt Hibbs Date: 2001-12-11T03:30:15+09:00 Subject: [ruby-talk:28120] Re: Status of keyword args? > From: Christian Boos [mailto:cboos@bct-technology.com] > Sent: Monday, December 10, 2001 9:01 AM > > I guess I missed the thread about keyword arguments... > > Are people really liking the idea? > I think this would add a lot of verbosity. I remember that for another > language (O'Caml -> O'Labl), I found the idea interesting ... until I > tried it for a while! > It doesn't necessarily make your program more readable, and it quickly > becomes a pain to write this additional info when you obviously know > the meaning of each argument. I've never used O'Caml, but if it forces you to use only keyword arguments, then I think that it a bad implementation of keyword arguments. Proper use of keyword arguments should make the code more readable, not less. > At least I would suggest to make this feature optional. > I'm also afraid that it would complexity the C API of Ruby. Definitely! The guidelines I used to follow (when I had the option of using keyword arguments) was that required parameters were positional, followed by all optional parameters (i.e. those with default values) as keyword parameters. This keeps all calls to such a method as simple as possible (in the normal case) with the ability to specify optional parameters in an intuitive and immediately understandable way. > Btw. if one wants keyword arguments, what's wrong with the > current way of doing it with a hash? It's better than nothing, and works quite well. However, its not as good as a first class implementation of keyword arguments. Its not obvious, for example, to easily discern the available parameters and their default values by casually perusing the code. Regards, Curt