Let’s talk about Type Coercion in Ruby

It’s a bit unusual to talk about type coercion in Ruby. Being a dynamically typed “message passing” language you generally don’t need to think about types too much. But a couple of days ago I was implementing my own “number like” class and I needed to be able to sum a large list. In Ruby overloading operators is easy and intuitive but there is one case that’s a bit more complicated. It’s pretty…