Closed dkorpel closed 3 months ago
I vaguely recall having getD originally intended to do more auto-wrapping and conversions but let me check the history and get back to you.
Finally remembered to look back at this, so yeah the difference is getD
does some implicit conversions where getFromVariant
is meant to be more strict. kinda like std.variant's get vs coerce.
So like say there's a float
in the variant. getD!double would allow that, since you can implicitly convert the double to float. getFromVariant!double would throw about a type mismatch.
I just never actually finished it and anyway, we should be ok checking the tag without duplicating as much logic so let's merge and maybe change the function again later to add useful conversions if they come up.
Is noticed that
getD!string
gives a string with an extra '\0' byte appended, because that's apparently howmakeUtf8StringFromWindowsString(wchar*)
works. I could make it use the same logic asgetFromVariant
, but then I wondered: why have two special cases forint
and string` anyway? Seems like a relic, but correct me if I'm wrong.