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

Instance_eval tramples over block's binding's ivars #2060

Closed
mvz opened this issue Oct 20, 2014 · 1 comment
Closed

Instance_eval tramples over block's binding's ivars #2060

mvz opened this issue Oct 20, 2014 · 1 comment
Assignees
Milestone

Comments

@mvz
Copy link

mvz commented Oct 20, 2014

On JRuby, the code below prints 1, 2, 2. On MRI and Rubinius, it prints 1, 2, 1.

class C
  def block_param &blk
    p blk.call
    @foo = 2
    p instance_eval &blk
    p blk.call
  end
end

@foo = 1
c = C.new
c.block_param { @foo }

Tested with 1.7.13 and 1.7.16.

@mvz mvz mentioned this issue Oct 20, 2014
@headius
Copy link
Member

headius commented Oct 20, 2014

See likely explanation and untested patch here: #1758 (comment)

@headius headius added this to the JRuby 1.7.17 milestone Oct 20, 2014
@headius headius added the core label Oct 20, 2014
@headius headius self-assigned this Dec 2, 2014
headius added a commit that referenced this issue Dec 2, 2014
@headius headius closed this as completed Dec 2, 2014
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