1.1 --- a/docs/rationale.txt Sun Oct 11 02:40:20 2009 +0200
1.2 +++ b/docs/rationale.txt Sun Oct 25 18:11:15 2009 +0100
1.3 @@ -146,3 +146,48 @@
1.4 * Module and class attributes, locals
1.5 * The exception:
1.6 * Instance attributes
1.7 +
1.8 +Wild idea: isn't AttributeError just evidence of a bug in the program?
1.9 +
1.10 + * Note down all attributes used by a particular name during its lifetime
1.11 + * Upon recording name usage, record the location of usage
1.12 + * Use the set of attributes to constrain the range of types that can be used
1.13 + without an AttributeError being raised
1.14 + * Convert all name usage to specific attribute usage (on the range of types
1.15 + found) for all attribute accesses
1.16 +
1.17 +Attributes on locals
1.18 +
1.19 + * Control-flow can make attribute tracking awkward:
1.20 +
1.21 + obj.x # obj must have x
1.22 + if ...: # (branch)
1.23 + obj = ... # obj reset
1.24 + obj.attr # obj must have attr
1.25 + else: # (branch)
1.26 + obj.name # obj must have x, name
1.27 + # (merge)
1.28 + # obj must have <nothing>
1.29 +
1.30 +Attributes on locals with loops
1.31 +
1.32 + * Loops complicate matters still further:
1.33 +
1.34 + obj.x # obj must have x
1.35 + while ...: # (branch)
1.36 + obj.y # obj must have x, y
1.37 + obj = ... # obj reset
1.38 + obj.z # obj must have z
1.39 + # (re-branch)
1.40 + # obj must have z, y (obj.y)
1.41 + # obj reset (obj = ...)
1.42 + # obj must have z, y (obj.z)
1.43 + # (merge)
1.44 + # obj must have <nothing>
1.45 +
1.46 +Attributes on attributes
1.47 +
1.48 + * Classes and modules should preserve single interpretations of attributes
1.49 + * Attributes on such attributes should accumulate on the targets
1.50 + * Tracking attributes on such targets is only useful for unknown targets
1.51 + * Instances cannot be relied upon to refer to a coherent set of targets
2.1 --- a/docs/related.txt Sun Oct 11 02:40:20 2009 +0200
2.2 +++ b/docs/related.txt Sun Oct 25 18:11:15 2009 +0100
2.3 @@ -11,3 +11,7 @@
2.4 CapPython limits attribute access in order to facilitate code verification:
2.5
2.6 http://mail.python.org/pipermail/python-dev/2008-September/082475.html
2.7 +
2.8 +Advocacy for limited module-level initialisation:
2.9 +
2.10 +http://plope.com/Members/chrism/import_time_side_effects