[MacRuby] #1364: NameError: uninitialized class variable in NSObject

MacRuby ruby-noreply at macosforge.org
Tue Aug 30 10:16:03 PDT 2011


#1364: NameError: uninitialized class variable  in NSObject
-------------------------------------------+--------------------------------
 Reporter:  satoh@…                        |       Owner:  lsansonetti@…        
     Type:  defect                         |      Status:  new                  
 Priority:  major                          |   Milestone:                       
Component:  MacRuby                        |    Keywords:  class variables, @@  
-------------------------------------------+--------------------------------
Changes (by lsansonetti@…):

  * milestone:  MacRuby 0.11 =>


Old description:

> satoh-MBP:trunk satounorio$ rvm use macruby
> Using /Users/satounorio/.rvm/gems/macruby-0.10
> satoh-MBP:trunk satounorio$ irb
> irb(main):001:0> module M
> irb(main):002:1>   @@hello = "hello"
> irb(main):003:0> end
> => "hello"
> irb(main):004:0> include M
> => NSObject
> irb(main):005:0> @@hello
> NameError: uninitialized class variable @@hello in NSObject
>
> irb(main):006:0> M.class_variables_get(:@@hello)
> NoMethodError: undefined method `class_variables_get' for M:Class
>
> irb(main):007:0> M.class_variable_get(:@@hello)
> => "hello"
> irb(main):008:0>

New description:

 {{{
 satoh-MBP:trunk satounorio$ rvm use macruby
 Using /Users/satounorio/.rvm/gems/macruby-0.10
 satoh-MBP:trunk satounorio$ irb
 irb(main):001:0> module M
 irb(main):002:1>   @@hello = "hello"
 irb(main):003:0> end
 => "hello"
 irb(main):004:0> include M
 => NSObject
 irb(main):005:0> @@hello
 NameError: uninitialized class variable @@hello in NSObject

 irb(main):006:0> M.class_variables_get(:@@hello)
 NoMethodError: undefined method `class_variables_get' for M:Class

 irb(main):007:0> M.class_variable_get(:@@hello)
 => "hello"
 irb(main):008:0>
 }}}

--

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/1364#comment:1>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list