Module names in imports
A module alias can be introduced via the as keyword, after which the original module name is inaccessible:
import std/strutils as su, std/sequtils as qu
echo su.format("$1", "lalelu")
The notations path/to/module or “path/to/module” can be used to refer to a module in subdirectories:
import lib/pure/os, "lib/pure/times"
Note that the module name is still strutils and not lib/pure/strutils, thus one cannot do:
import lib/pure/strutils
echo lib/pure/strutils.toUpperAscii("abc")
Likewise, the following does not make sense as the name is strutils already:
import lib/pure/strutils as strutils
当前内容版权归 nim-lang.org 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 nim-lang.org .