# Yield/splat problem in 1.8.6

**URL:** <https://www.ruby-forum.com/t/yield-splat-problem-in-1-8-6/130995>\
**Category:** Ruby\
**Created:** [March 5, 2008, 1:08am UTC](https://www.ruby-forum.com/t/yield-splat-problem-in-1-8-6/130995 "2008-03-05T01:08:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![steve](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f19dbf/32.png) [@steve](https://www.ruby-forum.com/u/steve)\
**Post date:** [March 5, 2008, 1:08am UTC](https://www.ruby-forum.com/t/yield-splat-problem-in-1-8-6/130995/1 "2008-03-05T01:08:10Z")

</div>

Hey guys,

I just came across this weird behavior in 1.8. It works in 1.9 so I’m  
assuming it’s a bug. Is this a known issue?

def yield\_array  
yield [1, 2]  
end

def yield\_\_yield\_array  
yield\_array {|a| yield(a) }  
end

def yield\_\_yield\_array\_\_with\_splat  
yield\_array {|\*a| yield(\*a) }  
end

yield\_\_yield\_array {|args| p args }  
yield\_\_yield\_array\_\_with\_splat {|args| p args }

# both as expected:

# =\> [1, 2]

yield\_\_yield\_array {|(a,b)| p a, b }

# as expected:

# =\> 1, 2

yield\_\_yield\_array\_\_with\_splat {|(a,b)| p a, b }

# NOT AS EXPECTED !!?!?!

# =\> [1, 2], nil

- steve  
[http://coderrr.wordpress.com](http://coderrr.wordpress.com)
