Import statement

After the import keyword, a list of module names can follow or a single module name followed by an except list to prevent some symbols from being imported:

  1. import std/strutils except `%`, toUpperAscii
  2. # doesn't work then:
  3. echo "$1" % "abc".toUpperAscii

It is not checked that the except list is really exported from the module. This feature allows us to compile against different versions of the module, even when one version does not export some of these identifiers.

The import statement is only allowed at the top level.

String literals can be used for import/include statements. The compiler performs path substitution when used.