Skip to content

Conversation

@Earlopain
Copy link
Collaborator

Blocks and lambdas inherit anonymous arguments from the method they are a part of. They themselves don't allow to introduce new anonymous arguments. While you can write this:

def foo(*)
  bar { |**| }
end

referecing the new parameter inside of the block will always be a syntax error.

I actually thought that the code snippet above would be a syntax error but apparently not. It seems a bit inconsistent but whatever 🤷

…ambda

Blocks and lambdas inherit anonymous arguments from the method they are a part of.
They themselves don't allow to introduce new anonymous arguments.
While you can write this:
```rb
def foo(*)
  bar { |**| }
end
```
referecing the new parameter inside of the block will always be a syntax error.
@kddnewton kddnewton merged commit 66a95e6 into ruby:main Jan 5, 2025
55 of 56 checks passed
@Earlopain Earlopain deleted the parser-translator-forwarding-blocks branch January 7, 2025 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants