Open HugoGranstrom opened 2 years ago
weird, I just tried , if you change the module to other like jsonutils
-> cstrutils
, it will not error you.
@bung87
weird, I just tried , if you change the module to other like jsonutils -> cstrutils , it will not error you.
It's because some modules in the stdlib requires the std /
prefix while others don't. jsonutils
is one which requires it while cstrutils
doesn't. Try this code for example:
import jsonutils
# Error: cannot open file: jsonutils
While this one works:
import cstrutils
When passing an import using the syntax:
to a typed macro the first part of the import is removed resulting in this:
which gives an error like:
macro identity(body: typed) = echo body.repr result = body
identity: import std/[jsonutils]
import jsonutils
C:\Users\hugog\code\nim\nimib\a.nim(7, 1) template/generic instantiation of
identity
from here C:\Users\hugog\code\nim\nimib\a.nim(8, 13) Error: cannot open file: jsonutilsimport std / [jsonutils]
$ nim -v Nim Compiler Version 1.7.1 [Windows: amd64] Compiled at 2022-06-17 Copyright (c) 2006-2022 by Andreas Rumpf
active boot switches: -d:release