Talk:Methods
From RubySpec
FIXME: some of the $ variables are not actually objects, are they??
I think they are. They just refer to things outside of Ruby
Jimd 02:46, 9 September 2007 (CDT)
Everything in Ruby is an object of course :) But some of the $ variables do more than just point at an object, they also have behavior. For example, a number of them validate the object you set them to, to ensure it's a string or IO or whatever. Headius 05:23, 9 September 2007 (CDT)
there are no functions, only methods
why, aren't they the same concept only called by different names? Jimd 03:03, 9 September 2007 (CDT)
The classic definition of a function is that it has no side effects, only inputs and return values. So strictly speaking, anything in Ruby could be a function, even if it's invoked against an object. However in general the distinction is a little weak when you're talking about an OO language where any function *could* easily be change to have additional side effects. There's also a subtle distinction between "functional invocation" versus "qualified invocation" when determining visibility; private methods can't be invoked against an explicit receiver, and can only be called with a functional style. This is why you can't call 1.puts("something") or self.puts("other"). Headius 05:18, 9 September 2007 (CDT)

