From: "David A. Black" Date: 2005-03-17T20:12:48+09:00 Subject: Re: [ruby2] will '@@' disapear in ruby2? Hi -- On Thu, 17 Mar 2005, Csaba Henk wrote: > On 2005-03-16, David A. Black wrote: >> Do you mean like: >> >> def class_factory >> return Class.new { @@x = 1 } >> end >> >> class_factory.class_eval { puts @@x } # 1 > > let's go on... replace your last line with: > > (c = class_factory).class_eval { puts @@x } > > and then: > > c.class_variables # => [] > @@x # => 1 > Object.class_variables # => ["@@x"] > > What you suggest defines a class variable of Object, not of the nameless > class. Ugh. Well, as I've said, I'd like @@var to disappear anyway :-) David -- David A. Black dblack@wobblini.net