In the numeric addition example:
interval<BASE> = (
BASE => int ; lower bound
(BASE .plus 1) => int ; upper bound
? (BASE .plus 2) => int ; tolerance
)
rect = {
interval<X>
interval<Y>
}
X = 0
Y = 3
the computed member keys in the struct become unsigned integers. If one wants to use this when validating a JSON object, the validation should presumably fail because JSON doesn't allow keys that aren't strings. With that being said, it may still be useful to use the string equivalent of a computed member key from numeric addition when validating a JSON key.
For example, it may be useful to use the CDDL above to validate:
{
"0": 10,
"1": 10,
"3": 10,
"4": 10,
"5": 10
}
but there exists no way in CDDL to denote that the string representation of a numeric value should be used instead. A tool could certainly allow for that (e.g. via some sort of --allow-member-keys-as-strings flag), but then there are all sorts of implied semantics for the string representations of those numbers, byte strings, etc.
So, at the end of the day, there should be a bit more info regarding the use of these control operators with JSON.
In the numeric addition example:
the computed member keys in the struct become unsigned integers. If one wants to use this when validating a JSON object, the validation should presumably fail because JSON doesn't allow keys that aren't strings. With that being said, it may still be useful to use the string equivalent of a computed member key from numeric addition when validating a JSON key.
For example, it may be useful to use the CDDL above to validate:
{ "0": 10, "1": 10, "3": 10, "4": 10, "5": 10 }but there exists no way in CDDL to denote that the string representation of a numeric value should be used instead. A tool could certainly allow for that (e.g. via some sort of
--allow-member-keys-as-stringsflag), but then there are all sorts of implied semantics for the string representations of those numbers, byte strings, etc.So, at the end of the day, there should be a bit more info regarding the use of these control operators with JSON.