Open timotheecour opened 4 years ago
import macros, strutils
const nimPrelude {.strdefine.} = "os,strutils,times,parseutils,hashes,tables,sets"
macro makeAnImport(modules: static[string])=
result = newStmtList()
for module in modules.split ',':
result.add quote do:
import `module`
makeAnImport(nimPrelude)
expandMacros:
makeAnImport(nimPrelude)
refs https://github.com/nim-lang/Nim/pull/16135#discussion_r530644051
benefits
import std/stdimports
instead ofinclude prelude
doesn't need a hierarchy, ie you can have overlapping categories as shown above
[1] docs can be autogenerated instead of duplicating the content (not DRY) as done in https://github.com/nim-lang/Nim/pull/16135: