Sarah Allen wrote:
>a method call is really a message to another object:
> 
> # This
> 1 + 2
> # Is the same as this ...
> 1.+(2)
> # Which is the same as this:
> 1.send "+", 2
> 
> That's all well and good, except that + isn't an ordinary method.  If I
> take another method like div:
> 
> # This
> 4.div(2)
> # Is not the same as
> 4 div 2
> 
> In fact the latter is a syntax error.
> 
> When I first learned Ruby I was led to believe that + is just a method
> with a funny name, 

It is.  As you've stated here:

> # This
> 1 + 2
> # Is the same as this ...
> 1.+(2)
> # Which is the same as this:
> 1.send "+", 2

..and here is the proof:

class Fixnum
  def +(val)
    return "hello"
  end
end

puts 1 + 2
puts 1.send("+", 2)

--output:--
hello
hello

Ruby gives you a choice with some methods, like +() and =(), to use a 
special syntax.  Special syntaxes are commonly known as "syntactic 
sugar".   What happens is that the "sugared syntax" is converted into 
the normal method call, so:

1 + 2  becomes 1.+(2)

and

obj.x = 10 becomes obj.x=(10)  (where the method name is 'x=')
-- 
Posted via http://www.ruby-forum.com/.