From: johng Date: 2005-05-27T09:15:19+09:00 Subject: Re: A different perspective on Ruby. |"It's 5.abs for absolute value, but Math.sqrt(5) for square root." | |Good point. That bugs me too. abs is a *function*, not logically a |method. > The definition of abs is not questionable; it returns self, negated > when self is negative, for all numeric value. On the other hand, > natural sqrt() may return float or integer, or something else. That's > the reason for sqrt() being a function in Math module. I may be missing something, but why does it matter what the return type is? What is wrong with always returning a float just like Math.sqrt does? -alternatively, although I prefer the first option- Why couldn't the implementation of sqrt "cast" the result to an instance of the current self's type? So, if you ask an integer to sqrt, you get an integer back? Like I said, maybe I am missing something, but it seems that sqrt is a verb applied to numbers. John.