-
Notifications
You must be signed in to change notification settings - Fork 147
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
Convenience comparison methods: lessThan(), greaterThan(), lessEquals(), greaterEquals() #1074
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1074 +/- ##
==========================================
+ Coverage 94.88% 94.93% +0.05%
==========================================
Files 18 18
Lines 7134 7286 +152
Branches 1137 1194 +57
==========================================
+ Hits 6769 6917 +148
- Misses 358 362 +4
Partials 7 7
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Meeting, Oct 29: We won't include this in V1 of the proposal, but will consider it for a follow up, after doing more deliberate design work on the API. |
My understanding from the meeting was that the team was willing to consider this in V1 but after the release of the specs to Stage 3 reviewers, with the justification that this proposal is not a breaking change and has no upstream or downstream dependencies inside or outside Temporal. It's also possible that reviewers may not want this which seems reasonable. But IMHO this seems like a low-cost usability win that's worth considering if possible. EDIT: here's the meeting notes where we agreed to continue considering this:
Regardless, sounds like there was interest in bikeshedding on the names and perhaps other parts of this proposal, so I'll open an issue for that purpose. |
Should this PR be closed? |
Converted to draft in order to make it more explicit that this is not a finished PR. @justingrant @ptomato how should we proceed with this? |
I've moved it over to Temporal V2 at: js-temporal/proposal-temporal-v2#6 |
After a few days of using
since
anduntil
, I'm now 100% converted to @gibson042's position that confusingly-ordered parameters are evil. While discussingdifference
last week before we decided to rename it tosince
anduntil
, we also discussed howcompare
also has confusing parameter order. The other thing that's annoying aboutcompare
is that it's not "chainable", so you can't read it left to right. Instead you have to wrap thecompare
call around your code which makes it harder to read.If it's not too late, I got inspired today and built (polyfill, tests, docs, spec) convenience comparison methods, tentatively named
greaterThan()
,lessThan()
,greaterEquals()
, andlessEquals()
. I don't have a strong opinion about the names other than wanting to not make them any longer.Here's an example. It's 13-24 fewer characters per call. Also IMHO it's easier to understand what the code is doing.
Here's another sample from the docs:
I wasn't sure about how to encode a simple if/else statement in the spec syntax. Is this valid?
If not, what's the right spec syntax to express this?