We blithely say that a ve.dm.AnnotationSet is a set of annotations. Yet we fundamentally rely on ordering (to write out tags in the correct order, which matters for say two language tags), and allowing multiple annotations which are in essence the same (because again for say language tags, [rtl, ltr, rtl] is not the same as [ltr, rtl]).
We should document this clearly, and rename the class to avoid the misleading word "set".
N.B. This task does not include supporting annotation normalization (which would be code that knows bold+bold+italic = bold+italic = italic+bold and regularizes text on paste, say).