Open dburov190 opened 5 years ago
I think everything is parsed as String. In general guessing the proper type and parsing it is quite complicated (and this package is very simple). For now you'll have to parse your parameters yourself (parse(Float64, x)
).
You're right about everything being parsed as a string, I didn't notice that... and yes, parsing is quite involved, but thanks to the standard parse
function you mentioned it's not that hard. For example, is it possible to add an optional default (which would be helpful in and out of itself, in case there's no key you're trying to retrieve) that would be used to infer the type? something like parse(typeof(default), x)
?
Isn't this what retrieve(s::ConfParse, block::String, key::String, t::Type) is for? It retrieves the key then parses it as a Float32?
@pixel27 Maybe it is, but I'd have no idea because it's not documented, not even in the simplest "examples" way... see #21 (:
I'll try to setup the documentation.
The parser retrieves values like "1e-3" as
String
s rather thanFloat64
variables, at least in the case of "INI" files.