Var scope question


#1

Is it correct to say that class variables ‘@@’ are similar to globals in
that they are global to their class?


#2

Hi –

On Sun, 19 Mar 2006, rtilley wrote:

Is it correct to say that class variables ‘@@’ are similar to globals in that
they are global to their class?

Their class, and subclasses of their class. They’re pretty
global-ish. That’s scheduled to be fixed^H^H^H^H^H^H^Hchange in Ruby
2.0, when they’ll be visible only to their class/module and the
instance methods inside it (as I understand Matz’s description).

David


David A. Black (removed_email_address@domain.invalid)
Ruby Power and Light, LLC (http://www.rubypowerandlight.com)

“Ruby for Rails” chapters now available
from Manning Early Access Program! http://www.manning.com/books/black


#3

removed_email_address@domain.invalid wrote:

Their class, and subclasses of their class. They’re pretty
global-ish. That’s scheduled to be fixed^H^H^H^H^H^H^Hchange in Ruby
2.0, when they’ll be visible only to their class/module and the
instance methods inside it (as I understand Matz’s description).

OK, thanks… about the time I fully understand it… things will
probably change :slight_smile:


#4

unknown wrote:

Hi –
global-ish. That’s scheduled to be fixed^H^H^H^H^H^H^Hchange in Ruby
2.0, when they’ll be visible only to their class/module and the
instance methods inside it (as I understand Matz’s description).

Any sense of when 2.0 might be released?

Jeff