citizen428.blog()

Try to learn something about everything

Wouldn't It Be Nice if Ruby...?

I love questions that start with “Wouldn’t it be nice if Ruby <insert perceived missing feature>?” because more often than not the answer is: “Just tell it to!”

Something like this happened on RubyLearning today, when fellow mentor José asked “Wouldn’t it be nice if Ruby was smart enough to realize that when a division has a remainder then it should use a floating result?” and once again the answer was “You mean like this?”:

I’m definitely not saying monkey-patching core classes with unexpected behavior is a smart idea (it’s NOT), but I always like how you can add behavior to Ruby if you really feel it’s necessary (and once again, I don’t in this case).

Comments