Let's imagine a code starting like this.
import os, times, glob, strutils
from nre import replace, Regex
proc decipher(file: string): string =
let pathsplit = splitPath(file)
let tail = pathsplit.tail.replace(Regex("^[\!\+\-]+\s"), "")
let head = pathsplit.head
....
In VS Code, I get the following message:
expression 'Regex' cannot be called
attempting to call routine: 'Regex'
found 'nfatype.Regex [declared in /home/svtz/.nimble/pkgs/regex-0.15.0/regex/nfatype.nim(46, 3)]' of kind 'type'
found 'nre.Regex [declared in /home/svtz/.choosenim/toolchains/nim-1.2.0/lib/impure/nre.nim(69, 3)]' of kind 'type'
How does one usually deal with such conflicts? Or is there something wrong with my Nim installation?
glob anyways imports the regex module ( https://github.com/nitely/nim-regex ). So you might as well just use that instead of importing nre.
nre will introduce a dependency on PCRE on your app, while the nim-regex module won't.
= pathsplit.tail.replace(re"^[\!\+\-]+\s", "")
without importing any regexp library explicitly, and it works fine.