537
submitted 2 months ago by [email protected] to c/[email protected]

Meme transcription:

Panel 1: Bilbo Baggins ponders, “After all… why should I care about the difference between int and String?

Panel 2: Bilbo Baggins is revealed to be an API developer. He continues, “JSON is always String, anyways…”

(page 2) 50 comments
sorted by: hot top controversial new old
[-] [email protected] 2 points 2 months ago

Protocol Buffers are hated, but they are needed.

[-] [email protected] 1 points 2 months ago
[-] [email protected] 1 points 2 months ago* (last edited 2 months ago)

I do, but I also don't think that's a silver bullet, unfortunately. There's convenience in code generation and compatibility, at least

[-] [email protected] 2 points 2 months ago

This is String - you’ve seen it before haven’t you, Gollum?

[-] [email protected] 1 points 2 months ago

json doesn't have ints, it has Numbers, which are ieee754 floats. if you want to precisely store the full range of a 64 bit int (anything larger than 2^53 -1) then string is indeed the correct type

[-] [email protected] 1 points 2 months ago

json doesn’t have ints, it has Numbers, which are ieee754 floats.

No. numbers in JSON have arbitrary precision. The standard only specifies that implementations may impose restrictions on the allowed values.

This specification allows implementations to set limits on the range and precision of numbers accepted. Since software that implements IEEE 754 binary64 (double precision) numbers [IEEE754] is generally available and widely used, good interoperability can be achieved by implementations that expect no more precision or range than these provide, in the sense that implementations will approximate JSON numbers within the expected precision. A JSON number such as 1E400 or 3.141592653589793238462643383279 may indicate potential interoperability problems, since it suggests that the software that created it expects receiving software to have greater capabilities for numeric magnitude and precision than is widely available.

https://www.rfc-editor.org/rfc/rfc8259.html#section-6

[-] [email protected] 1 points 2 months ago

Let me show you what Ethan has to say about this: https://feddit.org/post/319546/174361

load more comments
view more: ‹ prev next ›
this post was submitted on 30 Jun 2024
537 points (98.0% liked)

Programmer Humor

19187 readers
1374 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS