From: Christoph Neubauer Date: 2004-09-17T17:09:46+09:00 Subject: Re: class variable weirdness "Bob Sidebotham" wrote in message news:F7v2d.432470$M95.325276@pd7tw1no... > > But if I remove the commented line, above, then I get: > > uninitialized class variable @@var in Mod (NameError) > > This is with ruby 1.8.2 (2004-09-10) [i686-linux] > > Is this a bug, feature, or am I just missing something? > > Thanks, > Bob Sidebotham > Hi Bob ! It's the same behaviour on ruby 1.6.8 (2002-12-24) [i586-mswin32] "Programming Ruby, HTML Help edition (v0.3a)" says about Class Variables: >> Unlike global and instance variables, class variables must be initialized before they are used. Often this initialization is just a simple assignment in the body of the class definition. << As I understand Ruby and compiling/parsing techniques the error message says, that @@var is not initialized --> within the scope of Mod. As Mod could be included 'anywhere and anyhow' it's the one and only scope where it is possible in common to check/grant variable initialization. Kind Regards, Chris