#306 √ resolved
farleyknight

[BUG][PATCH] Class variables not available through modules

Reported by farleyknight | February 3rd, 2008 @ 06:06 PM | in 1.0 preview

Currently class variables which have been created in a module, and then included or extended by an instance of Class, are not available. An example:


module M
   @@cvar = :cvar
end

class C; end

C.include(M)

# The cvar is found
C.class_variables => ["@@cvar"] 

# But is not accessable
C.class_variable_get("@@cvar") => # raises 'class variable not found'

C.extend(M)
C.class_variable_get("@@cvar") => # also raises 'class variable not found'

A patch is forthcoming.. Still learning git..

Comments and changes to this ticket

  • farleyknight

    farleyknight February 3rd, 2008 @ 06:42 PM

    Not quite sure how to get these two commits formatted as one patch, but here's the first

  • farleyknight
  • farleyknight

    farleyknight February 4th, 2008 @ 01:08 PM

      • → Title changed from “[BUG] Class variables not available through modules” to “[BUG][PATCH] Class variables not available through modules”

    Included a patch for this.. Let me know if it's satisfactory.

  • zimbatm

    zimbatm February 5th, 2008 @ 12:13 AM

      • → State changed from “new” to “open”

    Thanks for participating. I took a look at your patches. You should probably move the fixture with the spec patch, which already looks fine. I don't have enough insight to approve the first patch. The best would be if you could come to the #rubinius channel and nag somebody like evan or rue to review it.

  • Ryan Davis

    Ryan Davis March 1st, 2008 @ 12:23 AM

      • → Assigned user changed from “” to “Brian Ford”

    Brian was just looking at a similar issue (and I just assigned him a similar bug). Please merge the two if they're the same.

  • Brian Ford

    Brian Ford March 17th, 2008 @ 07:24 PM

      • → State changed from “open” to “resolved”

    At least in 1.8.6p111, I do not see that extending a class with a module that defines class variables makes those variables available to the class.

    See commit 62687753 for specs and code related to this ticket.

  • farleyknight

    farleyknight March 17th, 2008 @ 07:34 PM

    Wow.. this was a long time ago. I believe the issue was trying to get RubyGems to install via setup.rb, and it was tripping over something in the RDoc.. I'm betting that this has already been fixed.. I might give it another try today.

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Tags