Var scope question

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

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 ([email protected])
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

[email protected] 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:

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs