1.1 --- a/docs/assignment.txt Sun Jun 03 20:50:19 2012 +0200
1.2 +++ b/docs/assignment.txt Mon Jun 04 01:03:02 2012 +0200
1.3 @@ -37,10 +37,9 @@
1.4 local preserved StoreName
1.5 global (module) preserved StoreAddress StoreAttrIndex
1.6 instance preserved StoreAttr StoreAttrIndex
1.7 - class -> class StoreAddressContext
1.8 + class -> class StoreAddressContext StoreAttrIndex
1.9
1.10 - Class assignments are not permitted except during initialisation and hence
1.11 - employ no unoptimised instruction
1.12 + Assignment of new class attributes is only permitted during initialisation
1.13
1.14 Access types:
1.15
2.1 --- a/docs/concepts.txt Sun Jun 03 20:50:19 2012 +0200
2.2 +++ b/docs/concepts.txt Mon Jun 04 01:03:02 2012 +0200
2.3 @@ -33,6 +33,14 @@
2.4 a class as a key to the object table, where the full name is a qualified path
2.5 via the module hierarchy ending with the name of the class.
2.6
2.7 +Rebinding of attributes outside classes and modules can be allowed if
2.8 +attribute usage observations are being used to detect such external
2.9 +modifications to such objects. Without such observations, such rebinding
2.10 +should be forbidden since apparently constant attributes might be modified in
2.11 +a running program, but code may have been generated that provides specific
2.12 +objects for those attributes under the assumption that they will not be
2.13 +changed.
2.14 +
2.15 See rejected.txt for complicating mechanisms which could be applied to
2.16 mitigate the effects of these restrictions on optimisations.
2.17
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/tests/attributes_class_rebind.py Mon Jun 04 01:03:02 2012 +0200
3.3 @@ -0,0 +1,12 @@
3.4 +#!/usr/bin/env python
3.5 +
3.6 +class C:
3.7 + e = 123
3.8 +
3.9 +def f(obj):
3.10 + obj.e = 456 # should rebind C.e
3.11 +
3.12 +f(C)
3.13 +result_456 = C.e
3.14 +
3.15 +# vim: tabstop=4 expandtab shiftwidth=4
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/tests/attributes_class_rebind_ambiguous.py Mon Jun 04 01:03:02 2012 +0200
4.3 @@ -0,0 +1,17 @@
4.4 +#!/usr/bin/env python
4.5 +
4.6 +class C:
4.7 + e = 123
4.8 +
4.9 +class F:
4.10 + def __init__(self):
4.11 + self.e = 789
4.12 +
4.13 +def f(obj):
4.14 + obj.e = 456 # should rebind C.e
4.15 +
4.16 +other = F()
4.17 +f(C)
4.18 +result_456 = C.e
4.19 +
4.20 +# vim: tabstop=4 expandtab shiftwidth=4