Structured Field Values ownership and compatibility
Ownership and Equality
Bare values have value equality and no mutable state. Byte sequences copy incoming arrays, and copy-out operations cannot change the stored bytes or hash. Boolean singletons are safe to reuse as bare values.
Items, inner lists, parameters, and collections are mutable and use reference
equality. Item/inner-list constructors copy supplied parameter collections.
Mutate parameters through their owning node; a StructuredFieldMember does not
introduce a second collection. Explicitly sharing a mutable item between lists
is possible, so modifying that item is visible to both lists.
Breaking Changes
- Scalar classes now derive from
BareItem, notStructuredFieldItem. Wrap values innew StructuredFieldItem(bareValue)before attaching parameters; inspect parsed scalars throughitem.Value. - Replace
ListMemberandDictionaryMemberwithStructuredFieldMember. Supply parameters to the item or inner-list constructor, notFromItem. - Replace null-valued parameters with
BooleanItem.True.TryGetValuereturning true always yields a non-null bare value. - Replace mutable byte-array access with
.Bytesfor reading or.ToArray()for a copy. - Replace
TokenMember,TokenValue,TokenParameter,TokenElements, andTokenInnerListwith the corresponding ordinary method andtype: ItemType.Token. - Mapper models and nested models must be classes; propagate
class, new()constraints through generic helpers. Invalid mappings fail at construction. - Empty list/dictionary input can now succeed in
TryParse. HTTP helpers distinguish a missing header from a present empty value. - Explicit Boolean true parameters serialize in shorthand.
ToString()remains diagnostic-only and must not be used as a substitute for serialization.