Hey Guys,
I'm rather new to Nim, but thought I'd dive a bit more into the language by building a Playfair cipher module to familiarize myself with the syntax and evaluate how I like it, but I keep running into an odd road bump anytime I want to import something from nimble and try to use it:
C:\dev\nim\playfair>nimble build && playfair
Looking for docopt (any version)...
Dependency already satisfied.
Building playfair/playfair.exe using c backend...
Hint: system [Processing]
Hint: playfair [Processing]
Hint: passphrase [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: sequtils [Processing]
Hint: betterstring [Processing]
utils\passphrase.nim(36, 49) Warning: '(passphrase: var PlayfairPassphrase; letters)' has no type. Typeless parameters are deprecated; only allowed for 'template' [TypelessParam]
Hint: docopt [Processing]
Hint: nre [Processing]
Hint: pcre [Processing]
Hint: util [Processing]
Hint: tables [Processing]
Hint: hashes [Processing]
Hint: etcpriv [Processing]
Hint: math [Processing]
Hint: times [Processing]
Hint: winlean [Processing]
Hint: unsigned [Processing]
Hint: options [Processing]
Hint: typetraits [Processing]
Hint: unicode [Processing]
c:\nim\lib\impure\nre.nim(231, 28) Error: ambiguous call; both system.and(x: T, y: T) and unsigned.and(x: T, y: T) match for: (uint32, int literal(7340032))
Traceback (most recent call last)
nimble.nim(990) nimble
nimble.nim(970) doAction
nimble.nim(725) build
nimble.nim(498) buildFromDir
Error: unhandled exception: Build failed for package: playfair [BuildFailed]
This is the code that is generating this error:
import "utils/passphrase"
import "docopt"
when isMainModule:
let doc = """
Playfair Cipher
Usage:
playfair encrypt <file> --pass <password> [--output <file>]
Options:
-h --help Show this screen.
--version Show version.
--pass <password> password to use to encrypt text in the <file>
"""
docopt(doc, version = "Playfair 0.0.1")
anyone happen to have any ideas as to what I'm missing here, this seems to happen with any module that uses nre?
I am on Windows 7 64-bit (I know, I know... but I don't have a choice for now.)
This is my current (fresh) version of Nim.
C:\dev\nim\playfair>nim -v
Nim Compiler Version 0.12.0 (2015-10-27) [Windows: amd64]
Copyright (c) 2006-2015 by Andreas Rumpf
git hash: 30cc353831a9727cfc6b4e7c379d9920b7041059
active boot switches: -d:release
even making a simple file that only imports nre will not compile with the same conflict, but a single file with strutils or sequtils works just fine.
Do you have a module called unsigned.nim in c:\nim\lib\core\, or are the contents of c:\nim\lib\deprecated\core\unsigned.nim not the same as: https://github.com/nim-lang/Nim/blob/devel/lib/deprecated/core/unsigned.nim ?
If so, your installation may have mixed with an old install somehow.
That fixed it. I believe your diagnosis is 100% correct, I used the .exe installer from nim-lang.org yesterday to update my version of Nim and didn't think to check if it nuked the old nim folder before it installed the newer version.
Your assistance is most appreciated, I'll have to keep that in mind the next time I go to upgrade.