Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libserialize: tuple-arity should be provided to Decoder::read_tuple #17595

Merged
merged 2 commits into from
Nov 2, 2014

Commits on Nov 1, 2014

  1. libserialize: tuple-arity should be provided to Decoder::read_tuple

    Currently `Decoder` implementations are not provided the tuple arity as
    a parameter to `read_tuple`. This forces all encoder/decoder combos to
    serialize the arity along with the elements. Tuple-arity is always known
    statically at the decode site, because it is part of the type of the
    tuple, so it could instead be provided as an argument to `read_tuple`,
    as it is to `read_struct`.
    
    The upside to this is that serialized tuples could become smaller in
    encoder/decoder implementations which choose not to serialize type
    (arity) information. For example, @TyOverby's
    [binary-encode](https://github.com/TyOverby/binary-encode) format is
    currently forced to serialize the tuple-arity along with every tuple,
    despite the information being statically known at the decode site.
    
    A downside to this change is that the tuple-arity of serialized tuples
    can no longer be automatically checked during deserialization. However,
    for formats which do serialize the tuple-arity, either explicitly (rbml)
    or implicitly (json), this check can be added to the `read_tuple` method.
    
    The signature of `Deserialize::read_tuple` and
    `Deserialize::read_tuple_struct` are changed, and thus binary
    backwards-compatibility is broken. This change does *not* force
    serialization formats to change, and thus does not break decoding values
    serialized prior to this change.
    
    [breaking-change]
    danburkert committed Nov 1, 2014
    Configuration menu
    Copy the full SHA
    ca6b082 View commit details
    Browse the repository at this point in the history
  2. 9 Configuration menu
    Copy the full SHA
    05f6bda View commit details
    Browse the repository at this point in the history