`defaultValue` pragma not respected on inner objects
kraptor opened this issue · comments
I've got a file similar to this:
type
GuiConfig* = object
window_width *{.defaultValue: 1024.} : int32
window_height *{.defaultValue: 400.} : int32
Config* = object
file *{.defaultValue: "file.bin".}: string
gui *: GuiConfig
When loaded with an empty INI file, gui.window_width and gui.window_height are not initialized with default values.
Thanks, I will check it
How do you load w/ empty ini file? SectionNotFoundException
exception will raises cuz gui
section does not exists
Oh, I was not clear enough: yes, you get an exception if the section is not found, but when it's present and missing the values.
For example, for the above definition and the following INI file:
file = "file.bin"
[gui]
Does not add the default values for window_width
and window_height
and I get an SectionNotFoundException anyway.
got it, im working on it
Oh! Thanks... I'm not in a hurry, but wanted to support you with things I find :)
Btw, it would be nice, even for sections not found, to construct a default object and add their default values, so I can initialize a config directly using default values even in the absence of a config file.