I feel really stupid but here goes. I'm writing a small note taking like
program in various languages. My add method fails to compile do to a type
mismatch. Here is the code:
import tables
type
JotzCollection = object
entries: Table[string, string]
titleSize: uint32
JOTZ_FILE_NAME: string
proc newJotzCollection (): JotzCollection =
var collection: JotzCollection
collection.entries = initTable[string, string]()
return collection
proc add(this: JotzCollection, name: string, note: string) =
this.entries[name] = note # ERROR occurs here.
proc dump(this: JotzCollection) =
for name, note in this.entries.pairs:
echo("$name => $note")
var collection = newJotzCollection()
collection.add("Matrix", "Was a great movie")
collection.add("Pulp Fiction", "No idea")
collection.dump()
Run
The error is: app.nim(16, 17) Error: type mismatch: got <Table[system.string,
system.string], string, string>
Any help is greatly appreciated. Going to do some more reading up on Nim so
hopefully either way I can find an answer. Thanks!