Closed theAkito closed 1 year ago
I assume Module C is the module that calls NimYAML functionality (load
/ dump
/ etc)? Then both A and B are visible in C and therefore visible when binding symbols in NimYAML's macros, because name binding in macros happens at the calling site.
That being said, the const in Module A you show does not seem to be the issue at all. The error says
[snip]/yaml/serialization.nim(1051, 55) Error: ambiguous identifier: 'debug' -- use one of the following:
meta.debug: bool
logging.debug: template (args: varargs[string])
The second debug
is a template, most probably this one. The problem seems to be that debug(arg)
can be written as arg.debug
which in this case is what NimYAML generates. I cannot reproduce the error with simpler code though.
My advice would be to call NimYAML somewhere where std/logging
is not directly visible. There should be a way to force Nim to bind the symbol as field but I don't know how.
@flyx
Fixed it like this.
import std/logging except debug
Thank you very much! 🙂
https://github.com/theAkito/zoominvitr/actions/runs/5957435803/job/16160211615#step:7:638
Module A
Module B
Module A has no relationship whatsoever to Module B. They do not import each other, nothing. The only way, they are in some way connected is that Module C is importing both at the same time. Module B also imports
yaml
, while Module A does not.So, how does
serialization.nim
know and, most importantly, care about a constant from a foreign module? How does this even collide?Do the fields need to be unique across the project?
This is the related code snippet from
serialization.nim
.When re-defining
ConfigSettings.debug
asConfigSettings.sDebug
, compilation succeeds, because the names are different.