From: Brian Candler Date: 2011-04-29T05:22:22+09:00 Subject: Re: Is everything object ? Josh Cheek wrote in post #995509: > There are only three _relevant_ things that I can think of right now > that > aren't objects. Let us say that a thing is relevant as a nonobject if it > means you can't manipulate it like an object (ie pass it as an argument, > store it in a variable, and call methods on it). The first is boolean > methods like "&&" and "||", the second is keywords like "class", and > "def", > the third is variables, which point to objects but are not objects > themselves, thus cannot be pointed to by other variables. I think it's reasonable to say that most operators in Ruby are in fact syntactic sugar for method calls; so are some other syntactic constructions like a[b] and a[b] = c. All these can be invoked equivalently using send, e.g. a.send(:[]=, b, c) However the assignment operators =, +=, -= etc are *not* mapped to method calls, in addition to the short-circuit boolean operators as you've already pointed out. It's perhaps also worth mentioning that literals don't invoke method calls; e.g. "foo" and /foo/ can't be intercepted by redefining String.new or Regexp.new -- Posted via http://www.ruby-forum.com/.