[IronPython] OnVarChanged() - Repost

Shri Borde Shri.Borde at microsoft.com
Thu Jun 22 08:31:41 CEST 2006

Sorry, only ModuleScope.GetGlobal can be overriden. For now, SetLocal is the best hook for you.

Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of John Mancine
Sent: Wednesday, June 21, 2006 1:43 PM
To: 'Discussion of IronPython'
Subject: Re: [IronPython] OnVarChanged() - Repost

-- I'm reposting this because I saw that it didn't show up on my list. I
apologize if this turns into a dupe. --


Thanks for the advice, but I actually noticed that when I do...

pyEngine.Execute("a=1"), I do not in fact hit ModuleScope.SetGlobal(), but I
do however hit ModuleScope.SetLocal(). I took your advice though and I
extended ModuleScope, but I found I had to override both SetGlobal and
SetLocal to catch all cases which works fine, but I feel like I'm shooting
in the dark a bit since I don't have a clear understanding as to what the
two versions are really for.

Care to shed some light on this? I am a bit lost as to what IronPython means
by 'local' and 'global' as it seems like they are very close to the same
thing in the sense that I can do engine.SetGlobal("a", 1) or
engine.Execute("a=1") and basically do the same thing but one goes through
SetGlobal() and one goes through SetLocal().

Take care,

> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users-
> bounces at lists.ironpython.com] On Behalf Of Shri Borde
> Sent: Wednesday, June 21, 2006 2:00 PM
> To: Discussion of IronPython
> Subject: Re: [IronPython] OnVarChanged
> You should be able to declare a type that inherits from ModuleScope,
> and override ModuleScope.Get/SetGlobal. That should be the hook you
> need. Then you can use engine.Execute("a=1", myCustomModuleScope).

users mailing list
users at lists.ironpython.com

More information about the Ironpython-users mailing list