-
Notifications
You must be signed in to change notification settings - Fork 158
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
Data-driven exceptions in calendar method lookups #2724
Comments
This seems in conflict with the goal of #2289 of reducing the number of observable Gets, which is the reason why we introduced these method records. Personally I'd be happy if we made this "post-merge" adjustment to #2519 — I also don't like this complexity. Let's talk about the conflict with the original goal in the next champions meeting. (But I wouldn't call these data-driven exceptions. They won't occur in any reasonable data; only with malicious calendar objects such as the |
Ah, I think that's a slight mischaracterization... #2289 wasn't about minimizing the raw count of observable Gets for any given operation, but rather about eliminating redundant observable Gets and (more broadly) minimizing leakage of spec algorithm internal details. The Calendar Methods Record approach is great and absolutely addresses that concern, I just think it would be better to populate them unconditionally.
👍 |
Temporal champions meeting, 2023-11-09: Richard's point has broad agreement. We'll make this adjustment, as it is essentially a code review comment from Richard on #2519 that didn't quite make it in before the PR was merged. |
The add and subtract methods of Plain{Date,DateTime,YearMonth} and ZonedDateTime and the until and since methods of PlainYearMonth perform conditional lookup of calendar methods, such that e.g.
Since we have agreed elsewhere that it is the responsibility of a calendar author to implement all methods (and indeed the constructors verify that the properties expected to be methods are at least present on a calendar argument), I think I would instead expect unconditional lookup of all methods that might be called... for example, in AddDurationToOrSubtractDurationFromPlainYearMonth:
A case can be made for keeping the lookups conditional in e.g. Temporal.Duration.{add,subtract,compare,round,total}, but even there I'm not sure it provides sufficient benefit to justify the complexity and potential for user issues.
The text was updated successfully, but these errors were encountered: