I'm more upset at the (get "abc" 1.9) and that "abc"[1.9] also works in Ruby, than I am that "5" * 3 results in "555". The former feels more surprising. There's an expectation that "*" must do something different to a string, so if in doubt I'd look it up. But that a float is quietly floor'ed was surprising enough to me that I've used Ruby for more than 20 years, written a compiler* for a good subset of Ruby, and still didn't realise.
Comment thread (1)