Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Parser: allow anonymous block args #8117
Related to #7157
In addition to being able to write this:
def foo(x, y, &block) end
Now you can write it like this:
def foo(x, y, &) end
That is, you can omit the block name.
Of course it also works with a type signature:
def foo(x, y, & : Int32 -> Int32) end
It might look more obscure but there's a reason we might go this way.
Right now the compiler infers a few things based on the signature and method definition:
This is nice but it has a few disadvantages:
So the idea would be:
Now, this PR is just the beginning direction: there's no breaking change here, just the possibility to omit the block argument name.