| | @@ -166,7 +166,10 @@ |
| 166 | 166 | An import gives the arguments: `import Ints := List(I64);`. Each |
| 167 | 167 | distinct list of arguments makes one *instance*: the module compiled |
| 168 | 168 | with `T` standing for `I64`. Two imports of `List(I64)`, in any modules, |
| 169 | | -share one instance. Since every instance is checked on its own, an |
| 169 | +share one instance, its variables and its `ERROR`s with it: two lists |
| 170 | +of arguments are the same when their types are the same (section |
| 171 | +5.10), an alias as what it stands for, and their procedures are the |
| 172 | +same procedures. Since every instance is checked on its own, an |
| 170 | 173 | operation the argument type doesn't support (adding two records, say) |
| 171 | 174 | is reported as an error in that instance. |
| 172 | 175 | |
| | @@ -1098,34 +1101,14 @@ |
| 1098 | 1101 | the compiled code checks for them is the implementation's choice |
| 1099 | 1102 | (appendix A); that they stop the program isn't. |
| 1100 | 1103 | |
| 1101 | | -**Object files.** A module can be compiled on its own, into an object |
| 1102 | | -file: its interface, what it exports as an importer sees it, and its |
| 1103 | | -code, in an intermediate form that a back end turns into any target's |
| 1104 | | -machine code. A program is made from the object files of its modules. |
| 1105 | | -An object file records the fingerprint of every interface it was |
| 1106 | | -compiled against, and of the whole source of every generic module it |
| 1107 | | -made an instance of, and stays current while its source and those |
| 1108 | | -don't change; when it isn't current, the compiler compiles |
| 1109 | | -the module again from its source. A program comes out the same |
| 1110 | | -whether its modules were compiled one at a time or all at once. |
| 1104 | +**Separate compilation.** An importer depends only on a module's |
| 1105 | +interface: what it exports, as an importer sees it, never its source |
| 1106 | +or its code. So a module can be compiled on its own, and a program |
| 1107 | +made from modules compiled at different times. Whether an |
| 1108 | +implementation does so, and into what, is its own choice (appendix |
| 1109 | +A); one that does makes the same program as if every module were |
| 1110 | +compiled together, and keeps one copy of each instance. |
| 1111 | 1111 | |
| 1112 | | -An instance is made from the generic module's source, and goes into |
| 1113 | | -the object file of the module that made it, named by the generic |
| 1114 | | -module, the fingerprint of its whole source, and its arguments. A |
| 1115 | | -type argument is named as it is built, down to its records, variants |
| 1116 | | -and enumerations, so that two arguments that are the same type |
| 1117 | | -(section 5.10) give one name: an alias, or a named pointer, array, |
| 1118 | | -slice, set or procedure type, is named as what it stands for, and a |
| 1119 | | -procedure type without its parameters' names. A record, variant or |
| 1120 | | -enumeration is named by where it is declared, with the fingerprint of |
| 1121 | | -its declaration: its module, its procedure if it is local to one, or |
| 1122 | | -the instance's name if an instance declares it, and its name. One |
| 1123 | | -given as a type argument must therefore be named, since each written |
| 1124 | | -anonymously is a type of its own. A procedure given as an argument is |
| 1125 | | -named by its module and its name. Two object files that hold an |
| 1126 | | -instance of the same name hold the same code, and the program keeps |
| 1127 | | -one. |
| 1128 | | - |
| 1129 | 1112 | **Messages.** The compiler reports an error with its file, line and |
| 1130 | 1113 | column, the line of source with the offending part underlined, and, |
| 1131 | 1114 | where they help, notes pointing at other places, such as where a name |
| | @@ -1693,9 +1676,10 @@ |
| 1693 | 1676 | every signed type divided by -1 stops the program (6.1). Writing a |
| 1694 | 1677 | string's bytes isn't defined (5.10). The atomic built-ins work on |
| 1695 | 1678 | `INT`, `UINT` and pointers (6.8). An integer constant past an |
| 1696 | | - extern's parameters goes as an `INT` (9). Modules compile on their |
| 1697 | | - own, into object files, and instances are named so that one type |
| 1698 | | - gives one name (section 10; appendix A). The library takes and gives |
| 1679 | + extern's parameters goes as an `INT` (9). An importer depends only |
| 1680 | + on a module's interface, so a module can be compiled on its own; |
| 1681 | + whether it is, and into what, is the implementation's (sections 3 |
| 1682 | + and 10; appendix A). The library takes and gives |
| 1699 | 1683 | `INT` for lengths, counts, descriptors, process ids and statuses, |
| 1700 | 1684 | `main`'s and `Rt.exit`'s among them, and `I32` for a character; |
| 1701 | 1685 | `I64` stays for what may pass an `INT` on a small target: a file's |
| | @@ -1711,8 +1695,11 @@ |
| 1711 | 1695 | - **The target.** Which machines and systems it compiles for, and the |
| 1712 | 1696 | names of their files (`linux-x86_64`, section 3); for each, the size |
| 1713 | 1697 | of an address, and so of `INT`, and whether it has reals. |
| 1714 | | -- **Object files.** Their format, and the intermediate form of the |
| 1715 | | - code in them (section 10); this compiler's is in `doc/ir.md`. |
| 1698 | +- **Separate compilation.** Whether modules are compiled on their own, |
| 1699 | + and if so into what: the object file, its format, the form of the |
| 1700 | + code in it, when one is out of date, and how an instance is named so |
| 1701 | + that the program keeps one (section 10). This compiler's are in |
| 1702 | + `doc/ir.md`. |
| 1716 | 1703 | - **Atomics.** How `CAS`, `XCHG` and `XADD` are made sequentially |
| 1717 | 1704 | consistent on a machine without atomic instructions (section 6.8): |
| 1718 | 1705 | on one with a single processor, by holding off interrupts while |