J-_-L
index | github | twitter | irbtools | pws | rubykraut | ruby on ubuntu | zucker | euler | fresh
28.11.11

Why you should switch to 1.9: Three Ruby 1.8 bugs

Ruby 1.8 dies in June 2012. This post shows some small examples, why this is good ;)

Version used for testing: ruby-1.8.7-p352. Everything works well in 1.9.

Bug: Inconsistent Float representation

>> a=1215449.9999999993
=> 1215450.0 
>> puts "a as Float:   #{a}\na as Integer: #{a.to_i}"
a as Float:   1215450.0
a as Integer: 1215449

Bug: Encoding issues

>> a = "text with ─ unicode"
=> "text with ─ unicode"
>> a.tr "─", '-'
=> "text with --- unicode"

Bug: RUBY_ENGINE is not defined

Not really a bug, but still pretty annoying. You always have to check if the constants exists before using it.

Creative Commons License

Comments

20.05.13
1|

you?

name
www
7plus3
gist #