Issue #14021 has been updated by jeremyevans0 (Jeremy Evans).

Status changed from Open to Rejected

Duplicate of #13547, #13691, #13898, #13939, and #13976

----------------------------------------
Bug #14021: Block parsing with arguments
https://bugs.ruby-lang.org/issues/14021#change-67273

* Author: kddeisz (Kevin Deisz)
* Status: Rejected
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.4.2
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
It appears that between 2.4.1 and 2.4.2, something changed with method argument parsing:

~~~
$ cat test.rb
#!/usr/bin/env ruby

def test(num)
  p num
  yield
end

test 5 { puts 'hello world' }

$ rbenv shell 2.4.1
$ ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin15]
$ ruby test.rb
5
hello world
$ rbenv shell 2.4.2
$ ruby -v
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin15]
$ ruby test.rb 
test.rb:8: syntax error, unexpected '{', expecting end-of-input
test 5 { puts 'hello world' }
        ^
~~~

I'm actually fine with this change, but it didn't used to emit a warning and it seems odd that a patch release would break this behavior. 



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>