string aritmetic, 180 versus 181

S

Simon Strandgaard

Today I upgraded from Ruby-1.8.0 to Ruby-1.8.1

this construction works with 1.8.0:

puts ("-"*40) + "\nattempting to match at I#{@position_input}"


But Ruby-1.8.1 conplains about it, and says:

../scanner.rb:249: warning: don't put space before argument parentheses

and result of the parentesis is 'nil'...


However changing it into this.. then it works

s = "-"*40
puts s + "\nattempting to match at I#{@position_input}"


I don't understand why parentesis don't work the same way ?
 
T

ts

S> puts ("-"*40) + "\nattempting to match at I#{@position_input}"

svg% ruby -ve '@a = "(1, 2)";puts ("-"*40) + "\nattempting to match at #{@a}"'
ruby 1.8.1 (2003-10-31) [i686-linux]
-e:1: warning: (...) interpreted as grouped expression
 
R

Robert Klemme

Simon Strandgaard said:
Today I upgraded from Ruby-1.8.0 to Ruby-1.8.1

this construction works with 1.8.0:

puts ("-"*40) + "\nattempting to match at I#{@position_input}"


But Ruby-1.8.1 conplains about it, and says:

./scanner.rb:249: warning: don't put space before argument parentheses

and result of the parentesis is 'nil'...


However changing it into this.. then it works

s = "-"*40
puts s + "\nattempting to match at I#{@position_input}"


I don't understand why parentesis don't work the same way ?

irb(main):001:0> VERSION
=> "1.8.0"
irb(main):002:0> puts (5,6)
(irb):2: warning: don't put space before argument parentheses
5
6
=> nil
irb(main):003:0> puts(5,6)
5
6
=> nil
irb(main):004:0>

It's not only the string arithmetic but a more general thing IMO. I guess
1.8.1 warns about ambiguities in more cases.

Cheers

robert
 
S

Simon Strandgaard

On Fri, 31 Oct 2003 13:07:22 +0100, Robert Klemme wrote:
[snip]
irb(main):001:0> VERSION
=> "1.8.0"
irb(main):002:0> puts (5,6)
(irb):2: warning: don't put space before argument parentheses
5
6
=> nil
irb(main):003:0> puts(5,6)
5
6
=> nil
irb(main):004:0>

It's not only the string arithmetic but a more general thing IMO. I guess
1.8.1 warns about ambiguities in more cases.

Yes it seems so.. except that the test::unit has change, this is the only
upgrade-problem I have observed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top