# HG changeset patch # User Paul Boddie # Date 1341774819 -7200 # Node ID a99e6bee4c515eb1feee5dd6136cadb2a20da1a5 # Parent cde9f22a20244582ff1b51d83427d30f44b6af92 Added notes about imports and circular import detection. diff -r cde9f22a2024 -r a99e6bee4c51 docs/concepts.txt --- a/docs/concepts.txt Sun Jul 08 21:01:52 2012 +0200 +++ b/docs/concepts.txt Sun Jul 08 21:13:39 2012 +0200 @@ -5,6 +5,7 @@ * Namespaces and attribute definition * Attribute usage observations + * Imports and circular import detection * Contexts and values * Tables, attributes and lookups * Objects and structures @@ -98,6 +99,32 @@ and class definition "locals" can be reliably employed in attribute usage observations. +Imports and Circular Import Detection +===================================== + +The matter of whether any given module is potentially modified by another +module before it has been completely imported can be addressed by separating +the import process into distinct phases: + + 1. Discovery/loading + 2. Parsing/structure processing + 3. Completion/code processing + +Upon discovering a module, a test is made to determine whether it is already +being imported; if not, it is then loaded and its structure inspected to +determine whether it may import other modules, which will then in turn be +discovered and loaded. Once no more modules can be loaded, they will then be +completed by undergoing the more thorough systematic processing of each +module's contents, defining program units and requesting the completion of +other modules when import statements are encountered. + +The motivation for such a multi-phase approach is to detect circular imports +in the structure processing phase before modules are populated and deductions +made about their objects' behaviour. Thus, globals belonging to a module known +to be imported in a circular fashion will already be regarded as potentially +modifiable by other modules and attribute usage observations will not be +recorded. + Contexts and Values ===================