1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/docs/namespaces.txt Fri Sep 26 23:48:05 2008 +0200
1.3 @@ -0,0 +1,33 @@
1.4 +Namespace Definition
1.5 +====================
1.6 +
1.7 +Module attributes are defined either at the module level or by global
1.8 +statements.
1.9 +
1.10 +Class attributes are defined only within class statements.
1.11 +
1.12 +Instance attributes are defined only by assignments to attributes of self
1.13 +within __init__ methods.
1.14 +
1.15 +(These restrictions apply because such attributes are thus explicitly
1.16 +declared. Module and class attributes can also be finalised in this way in
1.17 +order to permit certain optimisations.)
1.18 +
1.19 +Potential Restrictions
1.20 +----------------------
1.21 +
1.22 +Names of classes and functions could be restricted to only refer to those
1.23 +objects within the same namespace. If redefinition were to occur, or if
1.24 +multiple possibilities were present, these restrictions could be moderated as
1.25 +follows:
1.26 +
1.27 + * Classes assigned to the same name could provide the union of their
1.28 + attributes. This would, however, cause a potential collision of attribute
1.29 + definitions such as methods.
1.30 +
1.31 + * Functions, if they share compatible signatures, could share parameter list
1.32 + definitions.
1.33 +
1.34 +It is easier, however, to regard multiply defined classes and functions as
1.35 +non-constant and to either disallow optimisations or to actually prevent the
1.36 +program describing them from compiling.