views:

57

answers:

1

In Ruby I can use

result << (yield element)

and everything works, but if I do

result.push(yield element)

I get a warning about needing parentheses for future compatibility. I can change the above to

result.push(yield(element))

and the interpreter is happy again, but I don't understand why I need parentheses in one call to yield and not the other?

+3  A: 

You can ignore that warning. You won't get it anymore in 1.8.7 and later. The planned parser changes that were the reason for this warning, have been dismissed.

sepp2k