[Ironruby-core] ExecutionContext without references IronRuby
Tomas.Matousek at microsoft.com
Mon Jun 23 20:50:50 EDT 2008
This is by design. Ruby global variables are Ruby special feature, not all languages have such thing.
You can however use the scope and completely avoid statically referencing IronRuby assemblies:
var runtime = ScriptRuntime.Create();
var scope = runtime.CreateScope("Ruby");
In this example, "customers" is a method call that hits method_missing. The IronRuby's implementation of method_missing looks into the scope if run in a hosted environment.
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Ben Hall
Sent: Monday, June 23, 2008 5:23 PM
To: ironruby-core at rubyforge.org
Subject: [Ironruby-core] ExecutionContext without references IronRuby
This might be a bit of a strange request, but is it possible to get
access to the ExecutionContext without actually referencing the
As a quick demo, I wrote the following code:
ScriptRuntime runtime = IronRuby.CreateRuntime();
engine = IronRuby.GetEngine(runtime);
RubyExecutionContext ctx = IronRuby.GetExecutionContext(engine);
list = new List<string>();
Ideally, what I wanted to write was something more like but $customers
is always nil.
scope = engine.CreateScope();
I was hoping this would have had the same affect as the code above.
Is this by design, a limitation or a bug?
Ironruby-core mailing list
Ironruby-core at rubyforge.org
More information about the Ironruby-core