I’ve been playing with the DLR hosting interfaces and running ruby code
this
way; it’s a really, really nifty feature that I’m already loving!
I can see a lot of cool scenarios this will be useful, such as providing
a
good way to provide custom scripting support on applications and so on.
I have had some problems, however, in particularly trying to connect the
host with the scripts being executed inside the DLR. In my infinite
ignorance, I assume you would be able to use Script.SetVariable() (or
one of
the longer, but equal alternatives to it) to introduce global variables
into
the scope before executing or evaluating a script, but for the life of
me I
can’t seem to get it to work.
Am I just completely of the mark? or is it just not working at this
time?
We’re going to improve hosting API in DLR next month – there will be
several major changes and many minor ones. IronRuby will also plug
better to DLR due to these changes. For the time being, use only globals
(via RubyEngine.CurrentEngine.ExecutionContext.GlobalVariables
dictionary) for passing data from and to Ruby scripts.
Tomas
From: [email protected]
[mailto:[email protected]] On Behalf Of Tomas R.
Sent: Wednesday, November 07, 2007 3:44 PM
To: [email protected]
Subject: [Ironruby-core] Hosting the DLR and passing data to scripts
I’ve been playing with the DLR hosting interfaces and running ruby code
this way; it’s a really, really nifty feature that I’m already loving!
I can see a lot of cool scenarios this will be useful, such as providing
a good way to provide custom scripting support on applications and so
on.
I have had some problems, however, in particularly trying to connect the
host with the scripts being executed inside the DLR. In my infinite
ignorance, I assume you would be able to use Script.SetVariable() (or
one of the longer, but equal alternatives to it) to introduce global
variables into the scope before executing or evaluating a script, but
for the life of me I can’t seem to get it to work.
Am I just completely of the mark? or is it just not working at this
time?
–
Tomas R.
http://www.winterdom.com/weblog/
Hi Tomas,
<<
We’re going to improve hosting API in DLR next month – there will be
several major changes and many minor ones. IronRuby will also plug
better to DLR due to these changes. For the time being, use only globals
(via RubyEngine.CurrentEngine.ExecutionContext.GlobalVariables
dictionary) for passing data from and to Ruby scripts.
Thanks for the answer; I’ll keep my eyes on the DLR updates.
I did try using the GlobalVariables dictionary and that did work fine.
Any particular reason why the global variables are stored in the
GlobalVariables dictionary instead of the GlobalScope dictionary? (just
trying to understand better how it works)
Tomas R.
http://www.winterdom.com/weblog/