[Standards] Off-by-one error in XEP-372 "References"

Tedd Sterr teddsterr at outlook.com
Fri Dec 4 14:21:05 UTC 2020

"How to specify character ranges" is a problem that keeps appearing - can we resolve this once and for all, and then ensure we're consistent with that in all XEPs?

There are only three sensible options:

1. Start = first character (inclusive), end = last character (exclusive);
2. Start = first character (inclusive), end = last character (inclusive);
3. Start = Boundary before first character, end = boundary after last character.

Option 1 is what I presume most are familiar with as that's how indexing works in many programming languages, and option 2 makes some sense as you're pointing to the first and last characters to be included. The problem with the first two options is that it leads to this inclusive/exclusive confusion where the text seems to say one thing and the example says another.

Option 3 sidesteps that issue by indexing the positions between characters, rather than the characters themselves - so a character is either before or after a boundary, and is explicitly included or excluded from a range. Numerically, this is actually equivalent to option 1, but by describing it in this way, the confusion never arises.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.jabber.org/pipermail/standards/attachments/20201204/0610616a/attachment.html>

More information about the Standards mailing list