-
Notifications
You must be signed in to change notification settings - Fork 157
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
Allow relational comparison of instants #92
Comments
Comparing the instants themselves causes problems with comparing between different object types. Instead simply go |
Current spec text documents |
The .valueOf() is explicitly not an alias, because it’s a BigInt. BigInt is not automatically coerced and would therefore not be appropriate. But you are right in so far as these are conceptual equivalents to .valueOf()
… On 9 Oct 2018, at 16:13, Richard Gibson ***@***.***> wrote:
Current spec text documents nanoseconds as returning a value in in the range of 0 to 999999, and milliseconds as not including sub-ms precision. So what you're proposing (a getter of "nanoseconds since the epoch") is also an addition, and will need a good name that makes clear the absence of similar value truncation. If we affirmatively resolve this issue, then the name—or at least an alias thereof—is just valueOf().
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I think we're misunderstanding each other. The correspondence is more than "conceptual"... a BigInt-returning |
It would satisfy the issue, but we had this discussion in #74 so something has to give. What I'm thinking is that comparison of |
#74 was too jumbled in both scope (unfair equal consideration of instant vs. non-instant values) and reasoning (ignoring the implications of |
Comparing If we really want to have this kind of comparison, then the only way to achieve this would be by operator overloading putting the temporal objects (or at least
If you ask me, then I'd say that even in the 21st century we have proven to be capable of producing more Bad Parts™️. Let's not do more of that. That's why I'd say let it be explicit: use the |
I am conceptually in favor of comparing instants via a numeric member, but its name should have a single obvious meaning. I'm not sure And even with such a member, the result of |
I'm wondering if we should leave support for comparison operators as a case study for a future operator overloading proposal, and start with a comparison method. I just don't see a non-broken way to do this right now. |
I understand your sentiments, but |
I'd argue for throwing, and hope having a |
I would find it confusing if |
Between nanosecond-level comparison and |
Originally raised in #42 (comment) , and I'm opening as an independent issue per #74 (comment) .
I believe that instants should be comparable with built-in operators (e.g., ECMAScript is not Java and shouldn't force consumers into methods), and that such comparison should be strictly numeric and therefore ignore timezone (since instants are necessarily on a global timeline).
The text was updated successfully, but these errors were encountered: