#304 √ invalid
Le Huy

[BUG] a class can not access class variable of the module it extends

Reported by Le Huy | February 3rd, 2008 @ 04:26 AM | in 1.0 preview

huy@huy-desktop:/u01/rubinius/code$ ./shotgun/rubinius
irb(main):001:0> module Foo; @@a=true; def m; @@a; end; end
=> #<CompiledMethod:0x401b9 name=m file=(irb)>
irb(main):004:0> self.extend(Foo).m
=> true
irb(main):002:0> class Bar; end
=> Bar
irb(main):003:0> Bar.extend(Foo).m
NameError: uninitialized class variable @@a in Bar
   from Module(Class)#class_variable_get at kernel/core/module.rb:95
   from MethodContext#class_variable_get at kernel/core/context.rb:159
   from #<IncludedModule:0x401d1>(Class)#m at (irb):1
   from Object#irb_binding {} at (irb):3
irb(main):005:0> 

Comments and changes to this ticket

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