Strange argument error in Ruby 1.8.4 (2006-02-24)


#1

Hi there,

I found a strange difference somewhere between Ruby 1.8.4 (2005-12-24)
and Ruby 1.8.4 (2006-02-24).

Here the code:

h = {}
a = []
h[‘test’] ||= a.join ‘c’

ArgumentError: wrong number of arguments (2 for 1)
from (irb):5:in `[]’
from (irb):5

To fix it, I add parenthesis like that:

h[‘test’] ||= a.join(‘c’)

But I found it strange enough to ask the question.

Regards,