Skip to content
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

Editorial: Consider recombining ISO 8601 and calendar-specific operations #2948

Closed
ptomato opened this issue Sep 24, 2024 · 0 comments · Fixed by #2996
Closed

Editorial: Consider recombining ISO 8601 and calendar-specific operations #2948

ptomato opened this issue Sep 24, 2024 · 0 comments · Fixed by #2996
Assignees
Labels
editorial spec-text Specification text involved
Milestone

Comments

@ptomato
Copy link
Collaborator

ptomato commented Sep 24, 2024

We have several operations such as CalendarDateAdd that basically say this:

  1. If calendar is "iso8601", return ? DoTheISO8601Thing(parameters).
  2. Return ? DoTheCalendarThing(calendar, parameters).

where DoTheISO8601Thing is a completely specified AO like AddISODate and DoTheCalendarThing is an implementation-dependent AO like CalendarDateAddition. This split seems unnecessary and could probably make the spec text simpler if we had just one operation instead of three. Investigate whether this is an improvement and if so, prepare a PR.

@ptomato ptomato added spec-text Specification text involved editorial labels Sep 24, 2024
@ptomato ptomato added this to the Stage "3.5" milestone Sep 24, 2024
ptomato added a commit that referenced this issue Oct 4, 2024
This is the only place it's called from. This refactor is part of
consolidating the many calendar AOs.

See: #2948
ptomato added a commit that referenced this issue Oct 4, 2024
This is the only place it's called from. This refactor is part of
consolidating the many calendar AOs.

See: #2948
ptomato added a commit that referenced this issue Oct 4, 2024
This is the only place it's called from. This refactor is part of
consolidating the many calendar AOs.

See: #2948
ptomato added a commit that referenced this issue Oct 4, 2024
This is the only place it's called from. This refactor is part of
consolidating the many calendar AOs.

See: #2948
@ptomato ptomato self-assigned this Oct 4, 2024
ptomato added a commit that referenced this issue Oct 5, 2024
This is the only place it's called from. This refactor is part of
consolidating the many calendar AOs.

See: #2948
ptomato added a commit that referenced this issue Oct 5, 2024
This is the only place it's called from. This refactor is part of
consolidating the many calendar AOs.

See: #2948
ptomato added a commit that referenced this issue Oct 5, 2024
This is the only place it's called from. This refactor is part of
consolidating the many calendar AOs.

See: #2948
ptomato added a commit that referenced this issue Oct 5, 2024
This is the only place it's called from. This refactor is part of
consolidating the many calendar AOs.

See: #2948
ptomato added a commit that referenced this issue Oct 5, 2024
They are identical except for clamping the day value, so if we pass 1 as
the day value we get the same effect. The only caller was in
CalendarYearMonthFromFields.

See: #2948
ptomato added a commit that referenced this issue Oct 5, 2024
This is the only place it's called from. This refactor is part of
consolidating the many calendar AOs.

See: #2948
ptomato added a commit that referenced this issue Oct 5, 2024
Move the ISO 8601 code from CalendarDateFromFields and
CalendarYearMonthFromFields into CalendarDateToISO. At this point it just
consists of RegulateISODate anyway.

To achieve this, we also drop the requirement that CalendarDateToISO
checks its return value is in the representable range, instead moving that
to CalendarDateFromFields and CalendarYearMonthFromFields since it is
different in both cases.

See: #2948
ptomato added a commit that referenced this issue Oct 5, 2024
…ceDate

Move the ISO 8601 code from CalendarMonthDayFromFields into
CalendarMonthDayToISOReferenceDate.

See: #2948
ptomato added a commit that referenced this issue Oct 5, 2024
Having two separate operations for this was already confusing just because
of the names. Combine them into an ISO 8601 part and an implementation-
defined part, as in CalendarDateToISO.

See: #2948
ptomato added a commit that referenced this issue Oct 5, 2024
Having two separate operations for this was already confusing just because
of the names. Combine them into an ISO 8601 part and an implementation-
defined part, as in CalendarDateAdd.

In this case there was not really any specific implementation-defined
description except for the already existing description.

See: #2948
ptomato added a commit that referenced this issue Oct 5, 2024
Move the ISO 8601-specific code from CalendarEra, CalendarYear, etc., into
CalendarISOToDate.

See: #2948
ptomato added a commit that referenced this issue Oct 5, 2024
ISO 8601 has no extra fields, so just return an empty List from the
operation instead of asserting that we don't call it with the ISO 8601
calendar.

See: #2948
ptomato added a commit that referenced this issue Oct 5, 2024
Move the ISO 8601 code from ISOFieldKeysToIgnore into
CalendarFieldKeysToIgnore.

See: #2948
ptomato added a commit that referenced this issue Oct 5, 2024
Move the ISO 8601 code from ISOResolveMonth into CalendarResolveFields.

See: #2948
ptomato added a commit that referenced this issue Oct 5, 2024
These were all one line now, and should just call CalendarISOToDate.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
Move the ISO 8601 code from CalendarDateFromFields and
CalendarYearMonthFromFields into CalendarDateToISO. At this point it just
consists of RegulateISODate anyway.

To achieve this, we also drop the requirement that CalendarDateToISO
checks its return value is in the representable range, instead moving that
to CalendarDateFromFields and CalendarYearMonthFromFields since it is
different in both cases.

See: #2948
Closes: #2998
ptomato added a commit that referenced this issue Oct 7, 2024
…ceDate

Move the ISO 8601 code from CalendarMonthDayFromFields into
CalendarMonthDayToISOReferenceDate.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
Having two separate operations for this was already confusing just because
of the names. Combine them into an ISO 8601 part and an implementation-
defined part, as in CalendarDateToISO.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
Having two separate operations for this was already confusing just because
of the names. Combine them into an ISO 8601 part and an implementation-
defined part, as in CalendarDateAdd.

In this case there was not really any specific implementation-defined
description except for the already existing description.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
Move the ISO 8601-specific code from CalendarEra, CalendarYear, etc., into
CalendarISOToDate.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
ISO 8601 has no extra fields, so just return an empty List from the
operation instead of asserting that we don't call it with the ISO 8601
calendar.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
Move the ISO 8601 code from ISOFieldKeysToIgnore into
CalendarFieldKeysToIgnore.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
Move the ISO 8601 code from ISOResolveMonth into CalendarResolveFields.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
These were all one line now, and should just call CalendarISOToDate.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
This is the only place it's called from. This refactor is part of
consolidating the many calendar AOs.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
This is the only place it's called from. This refactor is part of
consolidating the many calendar AOs.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
This is the only place it's called from. This refactor is part of
consolidating the many calendar AOs.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
This is the only place it's called from. This refactor is part of
consolidating the many calendar AOs.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
They are identical except for clamping the day value, so if we pass 1 as
the day value we get the same effect. The only caller was in
CalendarYearMonthFromFields.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
This is the only place it's called from. This refactor is part of
consolidating the many calendar AOs.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
Move the ISO 8601 code from CalendarDateFromFields and
CalendarYearMonthFromFields into CalendarDateToISO. At this point it just
consists of RegulateISODate anyway.

To achieve this, we also drop the requirement that CalendarDateToISO
checks its return value is in the representable range, instead moving that
to CalendarDateFromFields and CalendarYearMonthFromFields since it is
different in both cases.

See: #2948
Closes: #2998
ptomato added a commit that referenced this issue Oct 7, 2024
…ceDate

Move the ISO 8601 code from CalendarMonthDayFromFields into
CalendarMonthDayToISOReferenceDate.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
Having two separate operations for this was already confusing just because
of the names. Combine them into an ISO 8601 part and an implementation-
defined part, as in CalendarDateToISO.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
Having two separate operations for this was already confusing just because
of the names. Combine them into an ISO 8601 part and an implementation-
defined part, as in CalendarDateAdd.

In this case there was not really any specific implementation-defined
description except for the already existing description.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
Move the ISO 8601-specific code from CalendarEra, CalendarYear, etc., into
CalendarISOToDate.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
ISO 8601 has no extra fields, so just return an empty List from the
operation instead of asserting that we don't call it with the ISO 8601
calendar.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
Move the ISO 8601 code from ISOFieldKeysToIgnore into
CalendarFieldKeysToIgnore.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
Move the ISO 8601 code from ISOResolveMonth into CalendarResolveFields.

See: #2948
ptomato added a commit that referenced this issue Oct 7, 2024
These were all one line now, and should just call CalendarISOToDate.

See: #2948
ptomato added a commit that referenced this issue Oct 8, 2024
ISOMonthCode was only used in CalendarISOToDate and in an assertion which
didn't really need to be there.

See: #2948
Ms2ger pushed a commit that referenced this issue Oct 8, 2024
ISOMonthCode was only used in CalendarISOToDate and in an assertion which
didn't really need to be there.

See: #2948
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editorial spec-text Specification text involved
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant