[MacRuby-devel] [MacRuby] #326: module_function implicit use breaks (ArgumentError) with 1-arg splat methods (w/test code)

MacRuby ruby-noreply at macosforge.org
Sat Sep 5 08:39:04 PDT 2009


#326: module_function implicit use breaks (ArgumentError) with 1-arg splat
methods (w/test code)
---------------------------+------------------------------------------------
 Reporter:  occam@…        |       Owner:  lsansonetti@…                      
     Type:  defect         |      Status:  new                                
 Priority:  major          |   Milestone:                                     
Component:  MacRuby        |    Keywords:  module_function splat ArgumentError
---------------------------+------------------------------------------------
 module_function works for explicit declarations, but seems to have a
 problem (ArgumentError) with 1-arg splat methods when used implicitly.  I
 think a fix here will help compatibility with various libraries (e.g.,
 Linguistics).  Best to show with code:

 module SplatTesting
     def use( *languages )
         p "def use( *languages )"
     end
     module_function :use

     module_function
     def useBROKEN( *languages )
         p "def useBROKEN( *languages )"
     end
 end
 SplatTesting.use                  #  => "def use( *languages )"
 SplatTesting.use 'foo'            #  => "def use( *languages )"
 SplatTesting.useBROKEN            #  => "def useBROKEN( *languages )"
 SplatTesting.useBROKEN 'foo'      #  wrong number of arguments (1 for 0)
 for useBROKEN: (ArgumentError)

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



More information about the MacRuby-devel mailing list