--0016e64b0448e432ac0477e1221b Content-Type: text/plain; charset=ISO-8859-1 On Sun, Nov 8, 2009 at 12:20 PM, Seebs <usenet-nospam / seebs.net> wrote: > I don't think that gives the right semantics in many cases. It's also > not clear that rebinding works: > > array_example.length++ > > What should this do? > Well, this is a very interesting question, as I discovered something about Ruby I didn't know from this... Say we have: class Foo attr_reader :bar def initialize @bar end end f oo.new f.bar + What do you think the value of a subsequent call to f.bar will be? I was surprised to discover that it indeed 1. Somehow + s mutating the ivar through a supposed "attr_reader" even though there is no corresponding bar ethod. In that case + ppears to be frobbing the ivar directly. Very strange. Even worse: class Foo def initialize @bar end def bar @bar + 1 end end f oo.new f.bar + Now what do you think the value of a subsequent call to f.bar will be? Indeed, it would be 3! I cannot begin to answer this question because Ruby is doing strange and unexpected things here, at least from my perspective... -- Tony Arcieri Medioh/Nagravision --0016e64b0448e432ac0477e1221b--