Incompatible behaviour of splat operator (*) with objects that implement #to_a 
(w.r.t. MRI)
-------------------------------------------------------------------------------------------

                 Key: JRUBY-5632
                 URL: http://jira.codehaus.org/browse/JRUBY-5632
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.6
         Environment: jruby-1.6.0 under OSX 10.6 and ruby-1.9.2p136
            Reporter: Loren Segal
            Assignee: Thomas E Enebo
            Priority: Minor


It seems that the behaviour of JRuby's splat operator is to call #to_a on an 
object to splat it out

    $ ruby -v
    ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.6.0]
    $ ruby -e 'class A; def to_a; nil end end; p *A.new'
    #<A:0x0000010086dd40>
    $ jruby -e 'class A; def to_a; nil end end; p *A.new'
    TypeError: `to_a' did not return Array
      (root) at -e:1


I'm honestly not sure if this is considered a bug in JRuby or MRI, but I'd like 
to see the behaviour consistent across implementations. It seems related to 
JRUBY-4584, if that helps.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to