[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

string aritmetic, 180 versus 181

Simon Strandgaard

10/31/2003 10:39:00 AM

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 ?

--
Simon Strandgaard
3 Answers

ts

10/31/2003 12:05:00 PM

0

>>>>> "S" == Simon Strandgaard <qj5nd7l02@sneakemail.com> writes:

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
----------------------------------------
attempting to match at (1, 2)
svg%




--

Guy Decoux

Robert Klemme

10/31/2003 12:07:00 PM

0


"Simon Strandgaard" <qj5nd7l02@sneakemail.com> schrieb im Newsbeitrag
news:pan.2003.10.31.10.38.45.430584@sneakemail.com...
> 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

Simon Strandgaard

11/1/2003 3:46:00 PM

0

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.

--
Simon Strandgaard