-
Notifications
You must be signed in to change notification settings - Fork 156
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
AddDurationToOrSubtractDurationFromPlainYearMonth: Move GetOptionsObject closer to the top #2721
Comments
This ordering was intentional — the design principle followed here is, perform validation on each argument in order (temporalDurationLike, then options). So, personally I'd prefer not changing anything here, especially as we are trying to keep changes as rare as possible this late in stage 3, but we can discuss it in the next champions meeting. |
I wouldn't count performing |
We discussed this in the Temporal champions meeting today (2023-11-09). Whether this adheres to the design guideline of processing each argument in order, is debatable. (We are a bit vague in the design guideline about what exactly is included in "argument processing".) But we don't see a compelling motivation to change it this late in stage 3 just for consistency unless there were a demonstration of how this causes a real problem, or how it is gratuitously different from the rest of Temporal. (To the best of our knowledge, the only difference for end users is in the exception that might get thrown if one of the steps fails.) |
I don't think "stage 3" is a valid argument for dismissing this issue, because the relevant algorithm was changed only recently (573de94). Before that commit,
Because #2670 is actually a normative change, but was incorrectly marked as editorial, I think it's okay to add a another editorial change to revert the AddDurationToOrSubtractDurationFromPlainYearMonth changes from #2670 and instead remove the second call to |
Thanks, that is a compelling reason to me. If a normative change was incorrectly landed as editorial, then we should revert it. |
Note, to revert to the previous observable behaviour, GetOptionsObject would end up as step 4, directly after BalanceTimeDuration, not directly before it. |
(Which is fine with me, personally. I think BalanceTimeDuration is arguably validation of the duration argument to |
This is also fine with me, because BalanceTimeDuration can't trigger any user-controlled code, so the only difference is which error is thrown (RangeError from BalanceTimeDuration or TypeError from GetOptionsObject). But it seems with #2727 applied, BalanceTimeDuration can no longer thrown an error, so it doesn't actually matter if GetOptionsObject is called before or after an infallible BalanceTimeDuration. |
AddDurationToOrSubtractDurationFromPlainYearMonth should probably call
GetOptionsObject
earlier to validate the user-supplied input before performing other user-visible operations. Maybe move it directly before theBalanceTimeDuration
call in step 3?The text was updated successfully, but these errors were encountered: