From: "David A. Black" Date: 2005-03-25T09:30:01+09:00 Subject: Re: Understanding instance variables --927295978-454731979-1111710578=:24592 Content-Type: MULTIPART/MIXED; BOUNDARY="927295978-454731979-1111710578=:24592" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --927295978-454731979-1111710578=:24592 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Hi -- On Fri, 25 Mar 2005, Bertram Scharpf wrote: > Hi, > > Am Donnerstag, 24. M=E4r 2005, 03:30:28 +0900 schrieb ts: >>>>>>> "B" =3D=3D Bertram Scharpf writes: >> >> B> class <> >> You are working with the singleton class (see what is the value of self >> when you make the assignement to @x), use the singleton class >> >> B> puts c.instance_variables, c.instance_eval( '@x') >> B> puts @x >> >> puts class <> class < > That means all three of > > c's Singleton < C < Object > > can have their own instance variables. > >>> c=3Dclass C ; self ; end.new >>> s=3Dclass << C ; self ; end Did you mean class << c ? (You had mentioned c's singleton class.) But either way... >>> [c,s,C,Object].zip( %w-I S C O-).each { |x,y| x.instance_eval '@x=3D'+y= =2Einspect } >>> [c,s,C,Object].collect { |x| x.instance_eval '@x' } > =3D> ["I", "S", "C", "O"] > > > Or is there something I missed? =2E.. that's correct: any object can have its own instance variables. David --=20 David A. Black dblack@wobblini.net --927295978-454731979-1111710578=:24592-- --927295978-454731979-1111710578=:24592--