-
-
Notifications
You must be signed in to change notification settings - Fork 52
Description
Suggestions:
- Instead of storing
KdlValue::Floatasf64, store it asString - Instead of storing
KdlValue::Integerasi128, store it as{ repr: String, radix: u32 }where the radix can only be2,8,10or16
This should make the library both simpler implementation-wise, but also more versatile
Since kdl parser can be used for any purpose, it should be up to the user of the crate to decide how to parse the values
This would improve performance because it would remove an unnecessary step in certain situations: The KDL library converts the int/float to a string, but then we have to .to_string() it back.
There is no logical distinction in KDL between real numbers, integers, and floating point numbers. It's up to individual implementations to determine how to represent KDL numbers.
from the spec
Given the above, i should be able to represent an i1024 or f512 in KDL by using the kdl crate - or any sort of number, but this is currently impossible
One difficulty with this approach is: What do we do about #inf, #-inf and #nan?. Personally, I think they could be represented by adding 2 new variants to KdlValue - KdlValue::Inf { is_positive: bool } and KdlValue::NaN.