From: matz@... (Yukihiro Matsumoto) Date: 2004-02-12T23:44:15+09:00 Subject: Re: Ruby Warnings Hi, In message "Ruby Warnings" on 04/02/12, "Chris Pine" writes: |I have been getting complaints that the code in my tutorial generates |warnings (just in chapter 5). So, I'm looking into it, and I notice the |following: | | irb(main):001:0> puts 'hello '.+ 'world' | (irb):1: warning: parenthesize argument(s) for future version | hello world | => nil | irb(main):002:0> puts 'hello ' + 'world' | hello world | => nil | |So why the warning? 'hello '.+ 'world' is a form of "recv.message arg", i.e. parentheses around argument are omitted apparently, and the expression itself is an argument to "puts". When you use method call as argument, don't omit parentheses, no exception. | It's a shame, because the code won't be nearly as |readable for newcomers to Ruby, littered as it will have to be with |parenthases. I think newcomers can easily be confused by a dot before plus. matz.