Ticket #47 (new defect)
Cannot pass a :symbol directly as a named parameter
| Reported by: | cremes@… | Owned by: | lsansonetti@… |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | MacRuby | Keywords: | symbol named keyed parameter |
| Cc: |
Description
Here's an example to illustrate. Code was tested against the "testing" branch from 20080405.
class A
def initialize
@h = {}
end
def setValue(val, forKey:key)
@h[key] = val
end
end
a = A.new
a.setValue("triple", forKey::three) # fails
a.setValue("triple", forKey: :three) # succeeds
three = :three
a.setValue("triple", forKey:three) # succeeds
a.setValue("triple", forKey:'three'.to_sym) # succeeds
When using the #:: syntax the parser mistakenly views it as an attempt to access the method #forKey on Object. At minimum it should probably throw a more useful error message and perhaps suggest adding a space between colons.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.


