Currently, element IDs use the id_t type in the Orchestra XSD. id_t is defined as:
<xs:simpleType name="id_t">
<xs:restriction base="xs:positiveInteger"/>
</xs:simpleType>
This allows for any positive integer to be used as an element ID, with no upper bound, which is awkward to handle in software.
Implementations either have to use a "big integer" type, if one is available, or fall back to using strings if not. This results in frequent conversions back and forth when a normal numeric value is required.
I propose adding an upper bound of 2^32 - 1 (2147483647) to id_t, so that implementations can represent these IDs in a signed 4-byte integer.
- Are there compelling use-cases for very large numeric IDs (greater than 2 billion)?
- I also considered setting the upper bound to 2^64 - 1 (to fit in a signed 8-byte integer), but this is already larger than JavaScript, for one, can represent natively
- If we do think that a significantly larger "ID space" is required for some applications, a better path forward would be to use string identifiers rather than numbers, but this is more of a breaking change
- Reducing the upper bound from infinity to not infinity is of course a breaking change, but I think the impact will still be low
New definition of id_t:
<xs:simpleType name="id_t">
<xs:restriction base="xs:positiveInteger">
<xs:maxInclusive value="2147483647"/>
</xs:restriction>
</xs:simpleType>
Currently, element IDs use the
id_ttype in the Orchestra XSD.id_tis defined as:This allows for any positive integer to be used as an element ID, with no upper bound, which is awkward to handle in software.
Implementations either have to use a "big integer" type, if one is available, or fall back to using strings if not. This results in frequent conversions back and forth when a normal numeric value is required.
I propose adding an upper bound of 2^32 - 1 (2147483647) to
id_t, so that implementations can represent these IDs in a signed 4-byte integer.New definition of
id_t: