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

[Truffle] Argument values assigned to local variables not available in block #2999

Closed
nirvdrum opened this issue May 28, 2015 · 2 comments
Closed
Milestone

Comments

@nirvdrum
Copy link
Contributor

Argument values assigned to local variables aren't available from blocks supplied to a method call. The following is a simplified example of something RSpec does:

def x(the_caller)
  yield
end

class X
  def y
    x(the_caller = caller) do
      p the_caller.first
    end
  end
end

X.new.y

MRI 2.2.2:

> ruby -v yo.rb 
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
"yo.rb:13:in `<main>'"

JRuby+Truffle:

> bin/jruby -X+T -v yo.rb 
jruby 9.0.0.0-SNAPSHOT (2.2.2) 2015-05-28 6ab4b4a Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b14 +jit [linux-amd64]
yo.rb:8:in `method_missing': undefined method `first' for NilClass (NoMethodError)
    from yo.rb:8:in `block in y'
    from yo.rb:2:in `x'
    from yo.rb:7:in `y'
    from yo.rb:13:in `<main>'
@eregon
Copy link
Member

eregon commented May 28, 2015

This is not a default argument but just an argument saved in a local variable, right?

@nirvdrum
Copy link
Contributor Author

You're right. I was tracking something else down and incorrectly reported that here. I'll update the title.

@nirvdrum nirvdrum changed the title [Truffle] Default argument values not available in block [Truffle] Argument values assigned to local variables not available in block May 28, 2015
@nirvdrum nirvdrum added this to the truffle-dev milestone May 29, 2015
@enebo enebo added this to the Non-Release milestone Dec 7, 2017
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

No branches or pull requests

4 participants