On Mar 31, 2008, at 5:22 PM, Laurent Sansonetti wrote:
Question, the docs imply that:
person.setFirstName(first, lastName:last)
Can't be written as:
person.setFirstName(first, lastName: last)
Is that true?
It is.
$ macirb irb(main):001:0> class Person irb(main):002:1> def setFirstName(first, lastName:last) irb(main):003:2> @first, @last = first, last irb(main):004:2> end irb(main):005:1> end => nil irb(main):006:0> p = Person.new => #<Person:0x1669890> irb(main):007:0> p.setFirstName('foo', lastName:'bar') => ["foo", "bar"] irb(main):008:0> p.setFirstName('foo', lastName: 'bar') => ["foo", "bar"] irb(main):009:0> p.setFirstName 'foo', lastName: 'bar' => ["foo", "bar"] irb(main):011:0> p.setFirstName 'foo', :lastName => 'bar' => ["foo", "bar"]
So, glad to know that the original problem seems to really be fixed in trunk. I am going to fix more bugs in trunk, then migrate the changes to the testing branch. The new Array class is now pretty functional.
Er, your example implies its not true, as lastName: 'bar' seemed to work just fine. T But I'm guessing that's just a case of too many double negatives. So: name( arg1, selector:arg2) (no space before arg2 works) name(arg1, selector: arg2) (extra space works) name arg1, selector: arg2 (no () works, with extra spaces) name arg1, :selector => arg2 ( : in front and => works) Pierce