From: Guillaume Cottenceau Date: 2001-07-05T06:39:43+09:00 Subject: [ruby-talk:17247] Re: enhancing Ruby error messages for out of the bound constant Fixnum? hal9000@hypermetrics.com writes: > > But with Ruby here, it silently does, well, I don't know: > > > > [gc@obiwan ~] echo -e "_123456789_" | ruby -w -pe 'sub(/ > \067/,"x")' > > _123456x89_ > > [gc@obiwan ~] echo -e "_123456789_" | ruby -w -pe 'sub(/ > \068/,"x")' > > _123456789_ > > [gc@obiwan ~] echo -e "_123456789_" | ruby -w -pe 'sub(/ > \070/,"x")' > > _1234567x9_ > > > > I *think* I know what's happening in the second case. > Ruby is smarter, not dumber, than you think. > It realizes that 8 is not a valid octal digit, so you get > a regex of an ASCII 6 followed by a character 8. Since this > pattern is not matched, nothing happens. 95% of the time, you'll shoot yourself in the foot without knowing that it overflows. -- Guillaume Cottenceau - http://mandrakesoft.com/~gc/