Gavin Sinclair wrote:
[ lots of clever stuff I agree with ]
> 5. Even for methods that have named parameters, anonymous arguments are
> allowed.  Mixing anonymous and named parameters in a method call is
> prohibited.

Does this imply that a method call must either use anonymous or named
parameters exclusively? I'd like to be able to specify the first X of
the arguments sequentially by position (as normal) and tag on the
remaining named parameters in any old order. (This seems to be the
current practice, with the Hash hack way of pseudo named parameters)

I think this could make some things more readable, e.g.:
 anArray.insert("new element", at_index: 5) # reads nicely
 anArray.insert(element: "new element", at_index: 5) # tad too verbose

Now, a tangent thought: The name given to a parameter which makes the
method _call_ readable is not necessarily a name that makes the method
_code_ readable. Now, we could reassing them to more suiting local
variables inside the method, but this is akin to using a hash and
pulling them out of it.

class Array
  def insert( element:, at: )
    # in here, 'at' is just plain ugly
    insertion_index = at 
  end
end
anArray = Array.new
anArray.insert("new element", at: 5 ) # but here 'at' is more readable

So I'll toss out the wild & crazy idea that... *drumroll* ... 
Named parameters can have aliases. Yep, you read that right. So that at:
would be an alias of insertion_index:, instead of us having to
compromise in the choice of variable names inside. And also, we could go
a little nuts, and allow:
  anArray.insert( "new element", at: 5 )
  anArray.insert( "new element", at_index: 5 )
  anArray.insert( "new element", insertion_index: 5 )

Now, before you call me utterly mad, keep in mind that with named
parameters, the names you choose in your API will be cast in stone. No
way of changing these later w/o breaking code that uses them, nor
refactor the names to something more readable. But if you could alias
them, it would be no problem. Old code would work, new code would use
more sensible named parameter names w/o having to use a method postfixed
with a version number. Besides, alot of things are already aliasable(?)
in Ruby, why not parameter names? ;-P

Ok, you can start flaming now.

(Note that I don't want changes to Array, I just use it as an example.)

> 6. When someone writes a method that takes named parameters, they should
> stop and think whether they can make it unnecessary (by reducing the number
> of parameters, for instance).

*goes back to nodding* 

-- 
(\[ Kent Dahl ]/)_    _~_    __[ http://www.stud.ntnu.no/~kentda/ ]___/~
 ))\_student_/((  \__d L b__/  NTNU - graduate engineering - 5. year  )
( \__\_/__/ ) _)Industrial economics and technological management(
 \____/_\____/ (____engineering.discipline_=_Computer::Technology___)