[MacRuby-devel] [MacRuby] #378: Macruby 0.5 allows instantiation of a Module instance

MacRuby ruby-noreply at macosforge.org
Sat Oct 10 09:26:52 PDT 2009


#378: Macruby 0.5 allows instantiation of a Module instance
---------------------------------------+------------------------------------
 Reporter:  keith.gautreaux@…          |       Owner:  lsansonetti@…        
     Type:  defect                     |      Status:  new                  
 Priority:  minor                      |   Milestone:  MacRuby 0.5          
Component:  MacRuby                    |    Keywords:                       
---------------------------------------+------------------------------------
 It seems that MacRuby treats modules differently than Ruby 1.9. You
 shouldn't be able to instantiate a named module using the new method, i.e.

 {{{
 A = Module.new do
   def meth1
     "hello"
   end
 end
 }}}

 YARV:
 {{{
 a = A.new => NoMethodError: undefined method `new' for A:Module
 }}}

 but it does in MacRuby returning an instance of A:Module which responds to
 the meth1 call:

 {{{
   a.meth1 =>"hello"
 }}}

 I believe the proper behavior (based on the 1.9 pickaxe documentation) is
 to allow extending of an object with A's methods but not instantiation.

 {{{
 a = NSObject.new
 a.extend(A)
 a.meth1 => "hello"
 }}}

 Once I figure out how to write specs I'll see if I can submit a failing
 one.

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/378>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list