Appearance
| 1 | namespace Compiler is | |
| 2 | use Collections.LIST | |
| 3 | use Collections.List | |
| 4 | ||
| 5 | // The imports `use default` stands for. A file that opens with it | |
| 6 | // gets these as if it had written them out, in this order. | |
| 7 | // | |
| 8 | // The set is what a program reaches for before it reaches for | |
| 9 | // anything specific: writing a line, the sequence combinators, and | |
| 10 | // the collections. Everything else stays an explicit import, so the | |
| 11 | // clause keeps meaning something a reader can hold in their head. | |
| 12 | // | |
| 13 | // A project that wants a different set replaces this one with | |
| 14 | // `--default-use`, one per name. | |
| 15 | class DEFAULT_USES is | |
| 16 | _curated: List[string] static | |
| 17 | ||
| 18 | init() static is | |
| 19 | _curated = LIST[string](["IO.Std.write_line", "Ghul.Pipes", "Collections"]) | |
| 20 | si | |
| 21 | ||
| 22 | // The names in force: the project's own set when it declared one, | |
| 23 | // and the curated set otherwise. | |
| 24 | names(flags: GLOBAL_BUILD_FLAGS) -> List[string] static => | |
| 25 | if flags.default_uses.count > 0 then flags.default_uses else _curated fi | |
| 26 | ||
| 27 | // What the curated set would be, for a project that declares no | |
| 28 | // set of its own. | |
| 29 | curated: List[string] static => _curated | |
| 30 | si | |
| 31 | si |