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

JC Brand lists at opkode.com
Mon Dec 7 09:34:08 UTC 2020


Thanks everyone for the feedback.

I've made a PR here: https://github.com/xsf/xeps/pull/1018

The proposed change is the have the begin index inclusive and the end 
index exclusive, similarly to how Converse and Xabber do it currently.

This is known as the Dijkstra convention, and I presume it's based on 
his proposal here: 
https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html

This matches how subsequence indexing is done in many programming 
languages and has the added advantages that 'end' minus 'begin' equals 
the length of the substring and if two referenced substrings are 
adjacent, then the 'end' of the first matches the 'begin' of the second.

This also appears to be the convention most people in the thread 
appeared to agree with.

- JC



On 04.12.20 13:31, JC Brand wrote:
> Hey folks
>
> In XEP-0372 in section 3.1, there is the following text:
>
>> An end attribute is similarly  used for the index of the last 
>> character of the reference
>
> However, in the example in 3.2, the "end" attribute is set to 78, 
> which is the index of the space after the nickname "Juliet".
>
> The example appears to contradict the text. I'd like to fix this, but 
> I'm not sure what the original author's intention was. I'm assuming 
> the text is correct and the example is wrong.
>
> AFAIK only Converse.js and maybe Movim support this incomplete XEP.
>
> If anyone else is using it, I'd appreciate it if you could let me know 
> which offset you're using. Converse is currently following the example 
> in the XEP, i.e. i+1.
>
> Thanks
> JC
>
>
> _______________________________________________
> Standards mailing list
> Info: https://mail.jabber.org/mailman/listinfo/standards
> Unsubscribe: Standards-unsubscribe at xmpp.org
> _______________________________________________



More information about the Standards mailing list