[IronPython] ScriptRuntime.Globals

Dino Viehland dinov at exchange.microsoft.com
Tue Mar 18 22:43:24 CET 2008


Globals is a place for hosts to put stuff that will be exposed in some language specific way.  I believe in Ruby the plan is to expose this as members that live in object.  In IronPython it gets exposed via import.  So if you put something into globals you should be able to do:

import foo

and get it back out.

The other ScriptScope’s that you can pass in get exposed in IronPython as module-level variables so they should be accessible to code by just referring to them directly.

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ivan Porto Carrero
Sent: Tuesday, March 18, 2008 4:35 PM
To: users at lists.ironpython.com
Subject: [IronPython] ScriptRuntime.Globals

Hi,

I'm working my way through the DLR hosting spec.

And in the spec docs there is a distinction between 3 levels of hosting. Now in the case of IronRuby I tried hosting it with level one hosting and all I can get to work is executing ruby files.
Whatever i put in ScriptRuntime.Globals doesn't matter because it looks like I can't get to it.

What is the function of ScriptRuntime.Globals ? How do I access it?
Why do ScriptScopes exist ? I saw that ScriptRuntime.Globals is a ScriptScope, so I guess that's the default script scope.  From what I understand from the DLR spec is that it should give you a context for running a script with it's own variables etc. but globals are shared by the entire runtime.

Is there somebody that can explain me what I'm not getting?

Cheers
Ivan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080318/829997d5/attachment.html>


More information about the Ironpython-users mailing list