Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macro blocks bleed scope #14449

Closed
Blacksmoke16 opened this issue Apr 7, 2024 · 1 comment
Closed

Macro blocks bleed scope #14449

Blacksmoke16 opened this issue Apr 7, 2024 · 1 comment

Comments

@Blacksmoke16
Copy link
Member

Normally block arguments are scoped to the block itself. For example:

v = nil

{1, 2, 3}.each { |v| }

pp v # => nil

However macro blocks do not seem to have the same behavior. This can lead to hard to debug bugs if the block param name happens to match a variable outside of the block.

{%
  v = nil

  {1, 2, 3}.each { |v| }

  v # => 3
%}
@HertzDevil
Copy link
Contributor

Duplicate of #11140

@HertzDevil HertzDevil marked this as a duplicate of #11140 Apr 7, 2024
@HertzDevil HertzDevil closed this as not planned Won't fix, can't repro, duplicate, stale Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants