# Var scope question

**URL:** <https://www.ruby-forum.com/t/var-scope-question/55256>\
**Category:** Ruby\
**Created:** [March 18, 2006, 5:49pm UTC](https://www.ruby-forum.com/t/var-scope-question/55256 "2006-03-18T17:49:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rtilley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce7236/32.png) [@rtilley](https://www.ruby-forum.com/u/rtilley)\
**Post date:** [March 18, 2006, 5:49pm UTC](https://www.ruby-forum.com/t/var-scope-question/55256/1 "2006-03-18T17:49:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rtilley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce7236/32.png) [@rtilley](https://www.ruby-forum.com/u/rtilley)\
**Post date:** [March 18, 2006, 6:08pm UTC](https://www.ruby-forum.com/t/var-scope-question/55256/2 "2006-03-18T18:08:13Z")

</div>

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](http://www.rubypowerandlight.com))

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

---

<div class="post-metadata">

**Author:** ![rtilley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce7236/32.png) [@rtilley](https://www.ruby-forum.com/u/rtilley)\
**Post date:** [March 18, 2006, 6:29pm UTC](https://www.ruby-forum.com/t/var-scope-question/55256/3 "2006-03-18T18:29:34Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![rtilley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce7236/32.png) [@rtilley](https://www.ruby-forum.com/u/rtilley)\
**Post date:** [March 19, 2006, 7:17am UTC](https://www.ruby-forum.com/t/var-scope-question/55256/4 "2006-03-19T07:17:25Z")

</div>

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
