[IronPython] Updating globals()
jvm_cop at spamcop.net
Wed Mar 29 18:21:09 CEST 2006
Not all attributes can be stored as static variables, or you couldn't add new ones at runtime. So there must also be a dictionary in the CustomDict subclass -- right? Are the only attributes that are made into statics the "all modules have these" names? (That is, the names I would find if I create a new Module object and examine it?) Or does make the names assigned in the __init__ method static as well?
What happens if one of the static-var-stored dictionary entries gets removed from one of these CustomDict subclasses? Is there a value that can be stored in the corresponding static variable that means "do a name lookup within superclasses to find this when you get this value (and raise a NameError if it's not found)" so that removing an entry will work correctly? (If retrieving one of the static-var-stored values is really just ldsfld / stsfld, with no check for whether the value returned means "there's no entry here", can things work right?)
Maybe I should do some testing -- but it might not be fruitful until the just-discovered bug is fixed.
At 06:09 PM 3/28/2006, Dino Viehland wrote (in part)
>When you are running from a module we generate a module type which is a subclass of CustomDict. That CustomDict stores the field values as static variables which allows quicker access than requiring a dictionary lookup each time through (in particular the module gets to just do a ldsfld / stsfld in IL to get the value, but setting the value from outside of the module is still relatively expensive).
J. Merrill / Analytical Software Corp
More information about the Ironpython-users