From: Nobuyoshi Nakada Date: 2010-01-14T12:10:18+09:00 Subject: [ruby-core:27584] Re: Strange behavior of String#append in 1.9 Hi, At Wed, 13 Jan 2010 20:42:33 +0900, Vladimir Sizikov wrote in [ruby-core:27583]: > ruby -ve "p 'test' << -1" > ruby 1.9.2dev (2010-01-13) [i686-linux] > "test\xFF" > > ruby -ve "p 'test' << -2" > ruby 1.9.2dev (2010-01-13) [i686-linux] > "test\xFE" > > ruby -ve "p 'test' << -3" > ruby 1.9.2dev (2010-01-13) [i686-linux] > -e:1:in `
': negative string size (or size too big) (ArgumentError) > > So, what's the proper/desired/correct behavior here? All of above should raise exceptions, I think. > P.S. In JRuby, we currently always raise ArgumentError on negative values. Integer#chr raises RangeError. -- Nobu Nakada