[Ironruby-core] RBX Question
Jimmy.Schementi at microsoft.com
Tue Apr 15 17:04:56 EDT 2008
> Unnikrishnan Nair writes:
> I see only difference is the there is no local variable concept when run in interpreter mode. Is this correct?
Yes, currently local variables don't work in rbx when running it interactively. The work to fix this is being done, though John/Tomas can chime in here about how close they are.
> What is the difference in running ruby code in interpreter mode on rbx and running rbx with ruby code in a file passed as a parameter?
It revolves around getting ruby Binding working properly. Here's a good explanation of binding: http://onestepback.org/index.cgi/Tech/Ruby/RubyBindings.rdoc/style/print
Binding lets you evaluate a block against an arbitrary scope. With a file, you use the same scope to execute the top-level code. However a console requires you to execute each line against the console's scope.
Methods, instance variables, and globals work without binding because they are implicitly declared on Object in some form or another, but local variables are defined in the binding.
Does that help clear things up?
More information about the Ironruby-core