-
Notifications
You must be signed in to change notification settings - Fork 39
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
spec: use int64, allow counter-flow messages #71
Conversation
It makes sense to use float64 where the measurement unit is a floating, but using it when we're sending integer quantities is actually a bit surprising. While it's true that `float64` is native to the i386 platform and `int64` it's not, I don't even know whether `int64` is slower than `float64` and, even if that was the case, it would probably be weird anyway to use `float64` rather than `int64`. Another reason why I was using `float64` is that I didn't know how to extact `int64`s from C code. But C code is gone in the previous commit. Conclusion: let's use `int64` instead. Now, why `int64` and not `uint64`? The different is subtle. We know that in many cases golang is using signed integers also for sizes, so that is not so surprising in golang. In Java there is no unsigned, so in theory I could say I am doing this for the sake of good old Java. The reality is that JSON cannot really serialize numbers larger than 2^53 as integers, therefore the distinction betwwn `int64` and `uint64` here is academic. Thus, I have picked the most natural feat in golang. (Should I check for overflow? In theory. In practice I think we are good for quite some years without checking for overflow of `int64` variables. Also, in the server side there are checks for overflow of `int64`, but not of `int53`. In the client side I think we should not care, since that is a minimal client.)
Pull Request Test Coverage Report for Build 446
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I like this in theory. But Javascript has no integers, so JS clients will convert this to float64
. Is that okay?
It is okay. I'll clarify that, thanks! |
Also, we don't have UDP overhead that we know of.
As mentioned in the spec, this is quite an academic concern for the moment and most likely in the future. However, clarify we have thought about this issue, we currently consider it relevant for pedantic implementations only, and recommend pedantic code to make sure the int53 boundary is correctly respected. We may change our mind in the future. (The most likely course of action is that we'll specify what a pedantic implementation is supposed to do in such case. For now it doesn't matter.)
Do not require these messages to be sent. Yet, require a party to be prepared to receive these messages. The reason why I'm doing this now is to take advantage of the recent bump in the specification version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 1 of 1 approvals obtained (waiting on @pboothe)
It makes sense to use float64 where the measurement unit is
a floating, but using it when we're sending integer quantities
is actually a bit surprising.
While it's true that
float64
is native to the i386 platformand
int64
it's not, I don't even know whetherint64
is slowerthan
float64
and, even if that was the case, it would probablybe weird anyway to use
float64
rather thanint64
.Another reason why I was using
float64
is that I didn't knowhow to extact
int64
s from C code. But C code is gone in theprevious commit. Conclusion: let's use
int64
instead.Now, why
int64
and notuint64
? The different is subtle. Weknow that in many cases golang is using signed integers also
for sizes, so that is not so surprising in golang. In Java there
is no unsigned, so in theory I could say I am doing this for
the sake of good old Java. The reality is that JSON cannot really
serialize numbers larger than 2^53 as integers, therefore the
distinction betwwn
int64
anduint64
here is academic. Thus,I have picked the most natural feat in golang.
(Should I check for overflow? In theory. In practice I think we
are good for quite some years without checking for overflow of
int64
variables. Also, in the server side there are checks foroverflow of
int64
, but not ofint53
. In the client side Ithink we should not care, since that is a minimal client.)
In addition to the above, there is also a17f14f that reallows
counter-flow messages. Will make upload better.
This change is![Reviewable](https://camo.githubusercontent.com/23b05f5fb48215c989e92cc44cf6512512d083132bd3daf689867c8d9d386888/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)