ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/CBOR-XS/doc/stringref.pod
(Generate patch)

Comparing CBOR-XS/doc/stringref.pod (file contents):
Revision 1.5 by root, Wed Apr 25 06:37:12 2018 UTC vs.
Revision 1.6 by root, Mon Apr 30 11:24:17 2018 UTC

187The semantics of stringref tags require the decoder to be aware and the 187The semantics of stringref tags require the decoder to be aware and the
188encoder to be under control of the sequence in which data items are 188encoder to be under control of the sequence in which data items are
189encoded into the CBOR stream. This means these tags cannot be implemented 189encoded into the CBOR stream. This means these tags cannot be implemented
190on top of every generic CBOR encoder/decoder (which might reorder entries 190on top of every generic CBOR encoder/decoder (which might reorder entries
191in a map); they typically need to be integrated into their works. 191in a map); they typically need to be integrated into their works.
192
193=head2 DESIGN RATIONALE
194
195The stringref tag was chosen to be short, without requiring standards
196action. The namespace tag is rare, so doesn't benefit from a short
197encoding as much.
198
199Implicit tagging/counting was chosen to support stream encoders. Having
200to tag strings first requires either multiple passes over the data (which
201might not be available, ruling out some encoders) or tagging more strings
202than needed (wasting space). Explicit tagging also isn't necessarily
203better even under optimal conditions, as the explicit tags waste space.
204
205Stream decoders are affected less by implicit tagging than encoders.
206
207The namespace tag was introduced for two reasons: first to allow embedding
208of CBOR strings into other CBOR strings, secondly for decoding efficiency
209- the decoder only has to expect stringref tags inside namespaces and
210therefore doesn't have to maintain extra state outside of them.
192 211
193=head1 EXAMPLES 212=head1 EXAMPLES
194 213
195The array-of-maps from the rationale example would normally compress to a 214The array-of-maps from the rationale example would normally compress to a
196CBOR text of 83 bytes. Using this extension where possible, this reduces 215CBOR text of 83 bytes. Using this extension where possible, this reduces

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines