From: "David A. Black" Date: 2003-12-04T03:23:59+09:00 Subject: Re: Attempted roadmap of future instance variables.... Hi -- On Thu, 4 Dec 2003, Robert Klemme wrote: > > "David A. Black" schrieb im Newsbeitrag > > class A > > def m > > instance_variable_set("@x",1) > > instance_variable_set("@_y",2) > > end > > This is all well, but what if you invoke those methods from the outside? OK, I think this illustrates your question (and a conjectural answer :-) Given this: class M def y1 @_y end end class N < M def y2 @_y end end if we do this: n = N.new n.instance_variable_set("@_y",100) which @_y got set? In other words, what will the two @_y-getters give us? puts n.y1 # M's view of n's @_y puts n.y2 # N's view of n's @_y I would tend to assume that we'd get nil 100 i.e., that instance_variable_set, if it has to choose a class-local scope as well as instance scope, would choose the object's "birth class". But I'm not certain. David -- David A. Black dblack@wobblini.net