From: ahoward Date: 2003-01-22T14:59:44+09:00 Subject: Re: accessors for module instance vars On 22 Jan 2003, Phil Tomson wrote: > That's certianly one way to do it... I guess I'm looking at Evolvable as > more of a namespace than a class that defines an object, though. a singleton is really nothing more than an encapsulation of some data and some methods - just like a namespace - but i understand your objection > And if I leave it as a module it could be mixed into a class later (though > that's not how I'm using it now) and all of the 'module instance variables' > would also end up in the class it was mixed into.... i don't think it works that way : module M attr_accessor :x @x = 42 end class Foo; include M; end p Foo.new.x # >> nil the instance variable STAY in M, that's what i was referring to when i said i was unsure of the semantics. -a -- ==================================== | Ara Howard | NOAA Forecast Systems Laboratory | Information and Technology Services | Data Systems Group | R/FST 325 Broadway | Boulder, CO 80305-3328 | Email: ahoward@fsl.noaa.gov | Phone: 303-497-7238 | Fax: 303-497-7259 ====================================