Project

General

Profile

Actions

Bug #682

closed

Rogue values bound to block parameters

Added by dblack (David Black) over 15 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
Backport:
[ruby-core:19503]

Description

=begin
Code:

def block_args_unleashed
yield(1,2,3,4,5)
end

block_args_unleashed {|a,b=1,*c,d,e|
puts "Arguments:"
p a,b,c,d,e
}

Output:

1
1
[3, 4]
5
"/usr/local/lib/ruby-1.9" # <-- ???

b binds incorrectly, but this report is about e, which is bound to an irrelevant string.

Version:

ruby 1.9.0 (2008-10-25 revision 18859) [i386-darwin9.5.0]
=end

Actions

Also available in: Atom PDF

Like0
Like0