Hello,
I should probably re-read Dominik's book but before I'll do that, can you help me with one problem. I'm still confused (as in "I forget" not "I don't understand") about module importing. Yesterday I was trying to hack a little toy I wanted to configure with ini files. I found configparser in Nimble and started writing code.
Let's assume I have two function, one responsible for picking up a file by file name and returning a string, the second one loads it into configparser and gets an usable object out of it.
import configparser
proc parseConfiguration(ini: string): Ini =
# real stuff going on here
var ini = parseIni(ini)
return ini
My problem is, there's no Ini type. I've read the configparser source code and it's there, but it has no star-export next to its definition.
So, in short I can't return an result of type that seems to be undefined (not exported from a library) that I get from a library's "constructor".
I think I just rubberducked myself out of this problem, I put auto as a return type and it compiled and worked. Is that reasonable solution?
There should be an error for exported procs that take private types as parameters or return types IMO.
I also advise you don't use this library in normal code as the person who wrote it is fairly new to Nim
There should be an error for exported procs that take private types as parameters or return types IMO.
Agreed, that's what put me in a head scratching moment.
I also advise you don't use this library in normal code as the person who wrote it is fairly new to Nim
Ah, well, so am I, didn't give the code proper read and just checked for types and procs signatures. Well, maybe I'll dump the config parsing for now and get back to it later.