Re: [jruby-user] JRuby head: splat (i.e., **args) method params?

Thomas E Enebo <[email protected]>
Newsgroups gmane.comp.lang.jruby.user
Message-ID <CAL5zZVkmDABYGJfZaLx+-z_tpgXzB9Xa0VauUntdK7GpKDFO7g@mail.gmail.com>
Can you give a more complete example.  This works for me:

class Foo
  def initialize(name, context,**opts)
    p opts
  end
end

Foo.new(1, 2, a: 1)

./bin/jruby -v snippets/kw15.rb
jruby 9000.dev-SNAPSHOT (2.1.2p142) 2014-09-02 8771d02 Java HotSpot(TM)
64-Bit Server VM 24.60-b09 on 1.7.0_60-b19 [darwin-x86_64]
/Users/enebo/work/jruby/lib/ruby/shared/rubygems/defaults/jruby.rb:92
warning: Ambiguous first argument; make sure.
/Users/enebo/work/jruby/lib/ruby/shared/rubygems/defaults/jruby.rb:96
warning: shadowing outer local variable - dir
{:a=>1}


On Tue, Sep 2, 2014 at 4:52 PM, Josep Blanquer <[email protected]>
wrote:

> Hello,
>
>  It seems that as of the latest head from today:
> jruby 9000.dev-SNAPSHOT (2.1.2p142) 2014-09-02 8771d02 Java HotSpot(TM)
> 64-Bit Server VM 24.0-b56 on 1.7.0_40-b43 [darwin-x86_64]
>
> The following 2.1 syntax is not implemented?
>
> ArgumentError: wrong number of arguments (3 for 2)
>                          initialize at /...../file.rb:11
>
> Where that line is:
>
>     def initialize(name, context,**opts)
>
>
> am I missing something to make that happen in the current codebase? or is
> this a well know feature that still has to be implemented?
>
> If the latter is true: do you have any inkling as to when that could be
> done?
>
> Thank you!
>
> Josep M.
>



-- 
blog: http://blog.enebo.com       twitter: tom_enebo
mail: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.