"Gavin Sinclair" wrote
....
> > For example, we only have "everything's an object" behavior
> > for some math intrinsics and the interface for files is a bit
> > strange, e.g., I expected 5.cos or aFile.rename('toThisName'),
> > not Math.cos(5) and File.rename(aFile,'toThisName').
>
> 5.cos, 5.arcsin, 5.tenthroot, 5.inverse, 5.negative, 5.prime?
>
> It has to stop somewhere.

Why? - once I get used to {}.inverse, 5.abs or 5.0.finite? I find
zero, zip, nil reasons for expecting why 5.0.inverse, 5.0.sin or
5.prime? would work differently?

>
> The methods you can call on numbers are intended, IMO, to represent the things
> that numbers have in common.  Operations like cos() make sense as pure
> functions.


Really?  A look at ``complex.rb'' might change your opinion.
Here are the relavant bits

---
module Math
    ...
    # alias old versions
     alias sinh! sinh
     alias cosh! cosh
     alias sin! sin

     ...
     def sin(z)
         if Complex.generic?(z)
             sin!(z)
        else
            Complex(sin!(z.real)*cosh!(z.image),
                           cos!(z.real)*sinh!(z.image))
       end
       ...
  end
---


If   ``sin'' was more consistently implemented as an instance
method of the buildin classes Float, Fixnum and this be
would be a

class Complex
    ...
    def sin
        Complex(real.sin * image.cosh, real.cos * image.sinh)
    end
end


If you ever wanted to add another Numerical class with a sensible
``sin'' method you need put another level of indirection into
the Math module_function  ``sin'' - none of this is very OO'ish
ihmo.


/Christoph