You get this warning because 0 (or the enum equivalent) is not a valid value 
for the type `RNA` and `newSeq` elements are initialized to 0. In the case of 
`map` the warning is wrong since the elements are properly initialized but the 
compiler couldn't follow the control flow.

Example: 
    
    
    proc test =
      var x = newSeq[range[1..1]](5)
    
    
    Run

You can add `--warning[ProveInit]:off` to your `nim.cfg` or add `{.push 
warning[ProveInit]: off.}` to your file.

Unrelated tip: If a table is constant and the keys are contiguous, you can just 
use an array to avoid hashing/lookups.
    
    
    const
      tblDNAtoRNA = [T: RNA U, A: A, G: G, C: C]
    
    proc transcribe(n: DNA): RNA =
      tblDNAtoRNA[n]
    
    
    Run

Reply via email to