From: Christophe Grandsire Date: 2005-10-21T20:54:23+09:00 Subject: Re: A comparison by example of keyword argument styles Selon "David A. Black" : > > > > Ruby has always favored implicitness over explicitness. The fact that > > I don't have to do anything explicitly in Sydney makes it the winner > > IMHO. > > I don't agree. If I write this: > > def meth(a,b,c) ... end > > I expect to be "allowed" to rename my parameters at will without > breaking any calling code. I'd even expect to be allowed to change, > say, (a,b,*c) to *args if I felt there was a good reason to. > > I don't want my choice of local variable names to be coupled to > calling code. If I offer keywords or hash keys, that means I've > decided that I *do* want to publish those names, and commit to them. > Otherwise I consider them strictly the method's business, not the > caller's. > Amen. As I keep saying, it's a matter of interface. If you allow implicit keyword arguments, you're suddenly mixing interface and implementation, and that is *wrong* (in the sense that it is difficult to maintain, and it breaks the promise of encapsulation). However, if you explicitly decide that some argument is a keyword argument, you have *consciously* made it part of the interface (I'd rather say part of the very *name* of the method), so you can still maintain the separation between interface and implementation to the level you want as a developer. And I disagree that Ruby favours implicitness. It favours dynamicity, openness, reflection, convention above configuration (and that's more a style common to many Rubyists and well exemplified in Rails). But that doesn't imply implicitness (pardon the pun, it was unintented). If anything, the fact that Ruby is strongly typed, even if dynamically typed, and hardly does any implicit casting (except among numbers, especially between Fixnum and Bignum), should be indicative that Ruby, if anything, *does not favour implicitness*. -- Christophe Grandsire. http://rainbow.conlang.free.fr It takes a straight mind to create a twisted conlang.