Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Alternatives to sed + awk



On Sun, Mar 13, 2011 at 3:49 PM, Josh Glover <jmglov@example.com> wrote:
> On 11 March 2011 14:32, Stephen J. Turnbull <stephen@example.com> wrote:
>
>> On Fri, Mar 11, 2011 at 10:18 PM, Josh Glover <jmglov@example.com> wrote:
>>
>>> Math.sin(Math.pi / 4)
>>
>> That's not a class method (it doesn't operate on the class).  It's a function,
>> that happens to live in the class namespace.  No?
>
> It's a class method. Ruby's namespace delimiter is also ::, so
> Math::some_function would be a function in the Math namespace.

Reread what I wrote.  It's not about syntax, it's about semantics.  .sin doesn't
care whether it lives in Math, String, or Ikebukuro -- its semantics are defined
without reference to any class.  (OK, I guess it would rather live in
Ikebukuro.)

Of course it's reasonable to hide sin in the class's method namespace, but
it's still just an ordinary function with a funny name.


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links