| 50 | |
| 51 | Notes on features which are almost certain to appear in Sysel in one way another. |
| 52 | |
| 53 | === Code organization === |
| 54 | |
| 55 | Sysel shall employ ''packages'' and ''modules''. Together, these two constructs provide full information about organization of the codebase and allow for a certain degree of freedom in how finely the code is partitioned, |
| 56 | |
| 57 | ==== Packages ==== |
| 58 | |
| 59 | Packages provide two main features: a namespace and visibility controls. Packages thus provide a greater level of isolation than mere classes and allow safe composition of code developed by different (uncoordinated) teams. Packages can have a well defined API/ABI and can be delivered in compiled form via libraries. Each package has a name which must be fully qualified. |
| 60 | |
| 61 | Within a package all symbol references only need to be qualified relative to the package. To reference symbols outside of the current package they must be ither imported or the reference must be fully qualified. (TODO: Should we enforce explicit import of all symbols?) Symbols can only be imported individually or in a qualified manner. This ensures that there can be no collisions of symbols from different namespaces (which need not be under the control of the same entity). When importing symbols the symbols being imported must be specified using their fully qualified names. |
| 62 | |
| 63 | ==== Modules ==== |
| 64 | |
| 65 | Modules provide a complementary and finer-grained means of decomposition. Usually each source file corresponds to exactly one module. For each module we define its (unqualified) name and fully qualified name of the package it belongs to (which 'anchors' it in the code base). Conversely, each package specifies all modules it consists of. Thus for each module we can determine which package it belongs to and for each package we can determine all modules (and thus all symbols) it consists of. |
| 66 | |
| 67 | Thus modules allow the source code to be broken into separate files and at the same time tie it together in a formal manner. When building a package or program, there is thus no need to specify all its source files informally in a makefile. It is sufficient to point the compiler to directories where it should look for source files and tell it which package we want built. |
| 68 | |
| 69 | Modules do not represent a namespace. Any symbols defined or imported in one module will be accessible (unqualified) in any other module within the same package. Names of global symbols in all modules of a package thus must be coordinated. Note that due to object-oriented nature of the language there are usually not very many global symbols defined per module. |
| 70 | |
| 71 | Definitions of classes can be split across multiple modules (but not packages). Thus large classes can be split accross multiple source files. |