[IronPython] Questions and Best Practices for Script Runtime and Script Engine

Marty Nelson Marty.Nelson at symyx.com
Thu Oct 9 00:09:40 CEST 2008


I have a ScriptingService static class that reuses the same
ScriptRuntime instance.  Is there any reason not to do this?  What would
be the boundary conditions at which I would want to use a different
ScriptRuntime?

 

Does the call to scriptRuntime.GetEngine("py") always return the same
engine instance?  Again, why or why not reuse the same instance?

 

Lastly, I was somewhat confused by the change from
ScriptRuntime.Create() to Python.CreateRuntime().  Are the runtimes, and
more importantly ScriptScope's, reusable with other DLR languages?  I
was expecting to be able to do something like the following:

 

ScriptScope scope = scriptRuntime.CreateScope();

 

ScriptEngine pythonEngine = scriptRuntime.GetEngine("py");

pythonEngine.CreateScriptSourceFromString(pythonScript,
SourceCodeKind.Statements).Execute(scope);

 

ScriptEngine rubyEngine = scriptRuntime.GetEngine("ruby");

pythonEngine.CreateScriptSourceFromString(rubyScript,
SourceCodeKind.Statements).Execute(scope);

 

 

Thanks,

 

- Marty Nelson



=======
Notice: This e-mail message, together with any attachments, contains
information of Symyx Technologies, Inc. or any of its affiliates or
subsidiaries that may be confidential, proprietary, copyrighted,
privileged and/or protected work product, and is meant solely for
the intended recipient. If you are not the intended recipient, and
have received this message in error, please contact the sender
immediately, permanently delete the original and any copies of this
email and any attachments thereto.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20081008/2612541a/attachment.html>


More information about the Ironpython-users mailing list