Skip to content

v0.32.0

Choose a tag to compare

@trendvidia trendvidia released this 04 Sep 10:34
· 11 commits to trendvidia since this release
980d178

One change: an annotation argument on pxf.BigInt, pxf.Decimal or
pxf.BigFloat is now carried in a member that can hold it.

⚠️ Changes which member those three carriers take

AnnotationArg gained big_int_value, decimal_value and
big_float_value in trendvidia/protowire#267 (schema v1.13). This is the
compiler emitting them.

carrier literal v0.31.0 v0.32.0
pxf.BigInt 42 int_value: 42 big_int_value
pxf.BigInt 18446744073709551615 rejected big_int_value, exact
pxf.BigInt 123456789012345678901234567890 rejected big_int_value, exact
pxf.Decimal 1.50 double_value decimal_value: unscaled 150, scale 2
pxf.BigFloat 1.2345678901234567890e19 double_value: 1.2345678901234567e19 big_float_value, exact
every other carrier — unchanged unchanged

Before v0.31.0 the rejected rows were a negative int_value — the
two's-complement bits — on the one type in the language whose stated
purpose is holding values above int64. v0.31.0 turned that into a
compile error; this makes it work.

The float spelling was never a workaround. It loses precision exactly
where these types earn their keep:

1.2345678901234567890e19  ->  12345678901234567168   through double_value
                          ->  12345678901234567890   through big_float_value

Per carrier, not per magnitude

@default(42) on a pxf.BigInt moves to big_int_value too. These types
carry what int64 and double cannot, so routing small values one way and
large ones another would give a consumer two cases for one type.

pxf.Decimal keeps its declared scale

bignum.proto states that the text form preserves exact scale, so "1.00"
has scale 2. Scale is read from the literal rather than from its value: a
normalising rational turns 1.50 into 3/2 and the trailing zero — the
author's statement of precision — is gone.

New dependency

proto/pxf/bignum.proto is now vendored, and gen/pxf is generated into
the public tree because the public carrier types reference it. If you
consume gen/protowire/schema/v1, you now also need gen/pxf.

What's Changed

  • Emit the arbitrary-precision AnnotationArg members (#206, #207).

Upgrading

Consumers reading AnnotationArg off pxf.BigInt, pxf.Decimal or
pxf.BigFloat fields need a case for the new members; every other carrier
is untouched. trendvidia/protowire-go pins the old behaviour deliberately
in TestCarrier_Int64BandSurvivesOnArbitraryPrecisionCarriers, so the
change surfaces there rather than landing quietly.