From: David Alan Black Date: 2002-08-05T04:26:28+09:00 Subject: Re: Range oddness ? Hi -- On Mon, 5 Aug 2002, Wejn wrote: > > The 'real' problem for me is that: > [...] > > raises exception for 'uid = 997' > > Well, my real problem is that I'm just heedless ... uid = "997", just > because it comes from ARGV :( > > But the 'p (1..4).type # => (1..4)' remains mystery for me ... What's happening is that it's being parsed as: (p (1..4)).type So the 'p' part happens (you see (1..4)), and .type is evaluated silently. I have to say I haven't gotten the hang of exactly how/when/why Ruby does one thing and not the other. I do know that it changed between 1.6.7 and 1.7.x, so you get: candle:~$ ruby/ruby -v ruby 1.7.2 (2002-05-11) [i686-linux] candle:~$ ruby/ruby -e 'p (0..4).type' Range You can always use parens to make sure: p ((0..4).type) David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav