I'm working with derived enum types and I'm encountering errors
"template/generic instantiation of map" warnings that I don't understand.
Here's a shortened version of my code:
import sequtils, tables
type
AmbigNucleotide = enum
T, A, G, C, U, W, S, M, K, R, Y, B, D, H, V, N
DNA = range[T..C]
RNA = range[A..U]
const
tblDNAtoRNA = {A: A, T: U, G: G, C: C}.toTable
proc transcribe(n: DNA): RNA =
RNA tblDNAtoRNA[n]
proc transcribe(ns: seq[DNA]): seq[RNA] =
map(ns, transcribe)
# I've also tried map[DNA,RNA](ns, transcribe) with the same results
let dna = @[DNA A, T, T, G, C, C, T, T]
let rna = transcribe(dna)
echo "DNA: ", dna
echo "Transcribed RNA: ", rna
Run
The code above compiles and works but I get the following warnings (edited to
highlight key lines):
example02.nim(17, 6) template/generic instantiation of `map` from here
sequtils.nim(311, 10) Warning: Cannot prove that 'result' is initialized.
This will become a compile time error in the future. [ProveInit]
Run
My key point of confusion is why this is a generic instantiation of map at all.
It seems the types are well defined.