1.1 --- a/docs/rationale.txt Sat Feb 23 21:25:03 2008 +0100
1.2 +++ b/docs/rationale.txt Sun Feb 24 01:27:16 2008 +0100
1.3 @@ -69,3 +69,35 @@
1.4 * Class loading tricks in Java
1.5 * Dynamic library loading magic in C/C++
1.6 * Has a place, but perhaps not in compiled, embedded programs
1.7 +
1.8 +Micropython modules
1.9 +
1.10 + * Modules contain attributes as with normal Python
1.11 + * Inside the module:
1.12 + * Attributes can be accessed and set as globals
1.13 + * Classes and functions define module attributes
1.14 + * Outside the module:
1.15 + * Attributes can be accessed but not set
1.16 + * Definition from within means more predictable content
1.17 +
1.18 +Micropython classes
1.19 +
1.20 + * Classes contain attributes and expose superclass attributes
1.21 + * Inside the class:
1.22 + * Attributes can be accessed and set in the class scope
1.23 + * Functions define methods
1.24 + * Outside the class:
1.25 + * Attributes can be accessed but not set
1.26 + * Definition from within means more predictable content
1.27 +
1.28 +Micropython instances
1.29 +
1.30 + * Instances contain attributes and expose class attributes
1.31 + * Instance attributes must not shadow class attributes
1.32 + * The set of attributes is detected by scanning the __init__ method
1.33 +
1.34 +Rationale for restrictions
1.35 +
1.36 + * Construct efficient run-time representations
1.37 + * Predictable content means that access can be optimised
1.38 + * No shadowing means that only a single lookup is necessary