--- CBOR-XS/doc/stringref.pod 2018/04/25 06:37:12 1.5 +++ CBOR-XS/doc/stringref.pod 2018/04/30 11:24:17 1.6 @@ -190,6 +190,25 @@ on top of every generic CBOR encoder/decoder (which might reorder entries in a map); they typically need to be integrated into their works. +=head2 DESIGN RATIONALE + +The stringref tag was chosen to be short, without requiring standards +action. The namespace tag is rare, so doesn't benefit from a short +encoding as much. + +Implicit tagging/counting was chosen to support stream encoders. Having +to tag strings first requires either multiple passes over the data (which +might not be available, ruling out some encoders) or tagging more strings +than needed (wasting space). Explicit tagging also isn't necessarily +better even under optimal conditions, as the explicit tags waste space. + +Stream decoders are affected less by implicit tagging than encoders. + +The namespace tag was introduced for two reasons: first to allow embedding +of CBOR strings into other CBOR strings, secondly for decoding efficiency +- the decoder only has to expect stringref tags inside namespaces and +therefore doesn't have to maintain extra state outside of them. + =head1 EXAMPLES The array-of-maps from the rationale example would normally compress to a