Closed hampuslidin closed 2 years ago
To be honest, I didn't have a specific use case in mind, other than it seemed to be a good candidate for constification (if that is a word). Although it was initiated by the use case of matching Yaml / Json like values to a static string description, I can not, after some more afterthought, think of any reason this might be used in a const context. I am using it in a slightly non semantic way also perhaps, as a way of abstracting a number, specifically, but I fully understand that the Value
and Number
might only be considered for use in a Serde context, in which case I can't think of any use case where it may apply in a const context. :)
In short, I might have opened this PR a little bit too hastily, and I wouldn't be sad if this was rejected in lack of a good use case.
For future PRs, I would recommend sticking to changes that you need or that other people have expressed a compelling use case for.
This adds the
const
keyword to most of the value getter and checker methods in theValue
andNumber
types. Some of them are not supported in aconst
context yet, such asstr
s and certain floating point operations (like checking forNaN
).