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

Inconsistence when modifying return object in ensure #3356

Closed
crccw opened this issue Sep 28, 2015 · 0 comments
Closed

Inconsistence when modifying return object in ensure #3356

crccw opened this issue Sep 28, 2015 · 0 comments
Labels
ir
Milestone

Comments

@crccw
Copy link

@crccw crccw commented Sep 28, 2015

Given code:

foo2 = 'dummy2'
result =  begin
    foo = 'dummy'
    foo
  ensure
    foo = foo2
  end
puts result, result.class

It works differently under MRI 2.2.1 and JRuby 9.0.1.0:

MRI 2.2.1:

dummy

JRuby 9.0.1.0:

dummy2

Most cases this won't be problem, but when you want to execute a block of code with a variable temporarily set to another values using the begin....ensure technique, you will get unwanted result. For example, tilt will not be able process erb files with JRuby due to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.