[swift-evolution] [Accepted] SE-0167: Swift Encoders
johannesweiss at apple.com
Tue May 9 11:27:59 CDT 2017
Sorry, I'm very late to the party but have one quick question that I think should be resolved/documented before the patch is landed:
[9851624185071827, 9851624185071829] as [Double] makes them
(so two different numbers get both mapped to a third number which sometimes causes problems in the real world )
The I(nternet)-JSON RFC  states that
Implementations that generate I-JSON messages cannot assume that
receiving implementations can process numeric values with greater
magnitude or precision than provided by those numbers.
For applications that require the exact interchange of numbers with
greater magnitude or precision, it is RECOMMENDED to encode them in
JSON string values.
I'm not sure if following that recommendation is a good idea but in any case I think it would be worth documenting it. Other encoders sometimes allow you to specify 'numbers as strings' as an option  or outright refuse to encode it.
Twitter also covers the subject  for its API.
> On 26 Apr 2017, at 12:10 am, Douglas Gregor via swift-evolution <swift-evolution at swift.org> wrote:
> Proposal Link: https://github.com/apple/swift-evolution/blob/master/proposals/0167-swift-encoders.md
> The review of SE-0167 "SE-0167: Swift Encoders” ran from April 6...12, 2017. The proposal is accepted. Thanks to everyone who participated in the review!
> - Doug
> Review Manager
> swift-evolution mailing list
> swift-evolution at swift.org
More information about the swift-evolution