[MacRuby] #347: module in module_function mode can't have methods with default args
#347: module in module_function mode can't have methods with default args -------------------------------------+-------------------------------------- Reporter: mattaimonetti@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.5 Component: MacRuby | Keywords: module_function module -------------------------------------+-------------------------------------- {{{ $ macruby -e "module Foo; module_function; def bar(baz=42); baz; end; end; p Foo.bar(2)" => -e:1:in `<main>': wrong number of arguments (1 for 0) (ArgumentError) }}} {{{ $ macruby -e "module Foo; def bar(baz=42); baz; end; end; include Foo; p bar(2)" => 2 }}} {{{ $ ruby19 -e "module Foo; module_function; def bar(baz=42); baz; end; end; p Foo.bar(2)" => 2 }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/347> MacRuby <http://macruby.org/>
#347: module in module_function mode can't have methods with default args -------------------------------------+-------------------------------------- Reporter: mattaimonetti@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.5 Component: MacRuby | Keywords: module_function module -------------------------------------+-------------------------------------- Comment(by occam@…): FYI, this bug looks a lot like ticket #326. For example, contrary to the reported example, the following explicit module_function declaration works (even though the rolling declaration style "module_function;" does not work). macruby -e "module Foo; def bar(baz=42); baz; end; module_function :bar; end; p Foo.bar(2)" => 2 FYI, so if you need (or want) a workaround, explicitly declare the "module_function :bar", and it should work (until rolling declarations are working as well). -- Ticket URL: <http://www.macruby.org/trac/ticket/347#comment:1> MacRuby <http://macruby.org/>
#347: module in module_function mode can't have methods with default args -------------------------------------+-------------------------------------- Reporter: mattaimonetti@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.5 Component: MacRuby | Resolution: fixed Keywords: module_function module | -------------------------------------+-------------------------------------- Changes (by lsansonetti@…): * status: new => closed * resolution: => fixed Old description:
{{{ $ macruby -e "module Foo; module_function; def bar(baz=42); baz; end; end; p Foo.bar(2)" => -e:1:in `<main>': wrong number of arguments (1 for 0) (ArgumentError) }}}
{{{ $ macruby -e "module Foo; def bar(baz=42); baz; end; end; include Foo; p bar(2)" => 2 }}}
{{{ $ ruby19 -e "module Foo; module_function; def bar(baz=42); baz; end; end; p Foo.bar(2)" => 2 }}}
New description: {{{ $ macruby -e "module Foo; module_function; def bar(baz=42); baz; end; end; p Foo.bar(2)" => -e:1:in `<main>': wrong number of arguments (1 for 0) (ArgumentError) }}} {{{ $ macruby -e "module Foo; def bar(baz=42); baz; end; end; include Foo; p bar(2)" => 2 }}} {{{ $ ruby19 -e "module Foo; module_function; def bar(baz=42); baz; end; end; p Foo.bar(2)" => 2 }}} -- Comment: Should be fixed in r2828. -- Ticket URL: <http://www.macruby.org/trac/ticket/347#comment:2> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby