I am getting tired of seeing messages from libraries I import, especially if I don't use all their functions. For example:
/Volumes/Macintosh_HD/Users/shauncutts/.nimble/pkgs/commandeer-0.9.1/commandeer.nim(231, 12) Hint: 'errormsg' is declared but not used [XDeclaredButNotUsed]
/Volumes/Macintosh_HD/Users/shauncutts/.nimble/pkgs/commandeer-0.9.1/commandeer.nim(220, 12) Hint: 'option' is declared but not used [XDeclaredButNotUsed]
/Volumes/Macintosh_HD/Users/shauncutts/.nimble/pkgs/commandeer-0.9.1/commandeer.nim(224, 12) Hint: 'option' is declared but not used [XDeclaredButNotUsed]
/Volumes/Macintosh_HD/Users/shauncutts/.nimble/pkgs/commandeer-0.9.1/commandeer.nim(234, 12) Hint: 'subcommand' is declared but not used [XDeclaredButNotUsed]
/Volumes/Macintosh_HD/Users/shauncutts/.nimble/pkgs/commandeer-0.9.1/commandeer.nim(214, 12) Hint: 'argument' is declared but not used [XDeclaredButNotUsed]
I tried wrapping the import in {.hint[XDeclaredButNotUsed]: off.} then {.hint[XDeclaredButNotUsed]: on.}. However, it would seem I can't turn it back on.
Do others share my pain here? Is there a good workaround... or is this a proposed feature somewhere? (I tried looking on github -- but perhaps I didn't search correctly.)
First: You wrote "off" in both. But I guess thats only wrong here in the forum :)
Did you try: {.push hint[XDeclaredButNotUsed]: off.} and later simply {.pop.} ?
Ah -- corrected the typo -- thanks!
I didn't notice the push/pop... hmm... the following doesn't work:
{.push hint[XDeclaredButNotUsed]: off.}
import commandeer
{.pop.}
However, if I put the push/pop around the routine where I use commandline, it works!
So very good... but still pretty quirky. I happen to be using commandline in exactly one place, so not so bad. But having to wrap some other piece of code in a module to suppress messages caused by an imported module seems ... unfortunate. If there were lots of uses of various symbols from commandeer in a large module, this would get tiring quickly.