=head1 REGISTRATION INFORMATION Tag 22098 (indirection) Data Item multiple Semantics hint that indicates an additional level of indirection Reference http://cbor.schmorp.de/indirection Contact Marc A. Lehmann =head1 SUMMARY This tag indicates an additional level of indirection when decoding a value. =head1 BACKGROUND Data structures in some languages or data models sometimes employ references, pointers or similar forms of indirection to represent relationships between values. For example, in Perl, CBOR arrays are usually represented as references to perl arrays, rather than arrays themselves, while simple scalar values are represented as these values themselves. However, CBOR leaves explicit references unencodable - while arrays and maps might implicitly result in references, references to simple values, or references to references are not representable. For example, in Perl: { 1, 2, 3, 4 } # reference to a hash, becomes CBOR map [ 1, 2, 3, 4 } # reference to an array, becomes CBOR array \5 # reference to the scalar value 5, needs extension \[] # reference to a reference to an array, needs extension This tag allows to encode such references - prefixing a value with this tag indicates a hint to the decoder that the original value was actually a reference. Decoders can chose to heed the hint (if their data model has a convenient representation), or simply ignore it and decode the value as-is. For example, CBOR encoders for Perl would not use the indirection tag for hash and array references, as the only way to reference these values in a data structure is already by reference. However, references to strings, numbers, other references or other complex objects would be encoded by tagging the referenced value with the indirection tag. Indirection tags can be nested - each additional level of nesting would indicate an additional indirection. =head1 EXAMPLES