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

Temporal: Remove support for nested property bags from TimeZone/Calendar protocol, and change validation #3813

Merged
merged 5 commits into from
Apr 10, 2023

Conversation

ptomato
Copy link
Contributor

@ptomato ptomato commented Apr 7, 2023

Normative PR: tc39/proposal-temporal#2485 which reached consensus in the January/February 2023 TC39 meeting.

The required changes to tests involve a lot of search-and-replace so I'd recommend reviewing this PR commit by commit and probably skimming over the boring parts. The good news is that the tests become much simpler overall, reflecting a simplification of the TimeZone and Calendar protocols in Temporal.

Copy link
Contributor

@justingrant justingrant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, amazing to get this done. Only a few minor nits & questions.

@@ -0,0 +1,24 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw a few brand-new tests in this PR that seem unrelated to the nested property bags. That seems fine to me, just wanted to confirm that this was intended.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the story behind this one is that it should've been here but for some reason was missing from PlainYearMonth.compare. (Probably an oversight on my part.) It would've previously had a nested property bag in it, which I would've removed in this PR.

Copy link
Contributor

@Ms2ger Ms2ger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I trust Philip and Justin here.

Previously, "nested" time zone property bags were unwrapped up to one
level. That is, this object:
{
  timeZone: {
     // ...Temporal.TimeZone methods
  }
}
would not be considered to implement the TimeZone protocol, but would have
its timeZone property used instead, if it were passed to an API that
required a TimeZone protocol object.

These nested property bags are no longer supported. Discussion:
tc39/proposal-temporal#2104 (comment)

Corresponding normative PR:
tc39/proposal-temporal#2485
Previously, "nested" calendar property bags were unwrapped up to one
level. That is, this object:
{
  calendar: {
     // ...Temporal.Calendar methods
  }
}
would not be considered to implement the Calendar protocol, but would have
its calendar property used instead, if it were passed to an API that
required a Calendar protocol object.

These nested property bags are no longer supported. Discussion:
tc39/proposal-temporal#2104 (comment)

Corresponding normative PR:
tc39/proposal-temporal#2485
Checking whether an object implements the TimeZone protocol is now done by
means of HasProperty operations for each of the required methods unless
the object already has the TimeZone brand.

Discussion:
tc39/proposal-temporal#2104 (comment)

Corresponding normative PR:
tc39/proposal-temporal#2485
Checking whether an object implements the Calendar protocol is now done by
means of HasProperty operations for each of the required methods unless
the object already has the Calendar brand.

Discussion:
tc39/proposal-temporal#2104 (comment)

Corresponding normative PR:
tc39/proposal-temporal#2485
Suggestion from Justin Grant's code review.
@ptomato
Copy link
Contributor Author

ptomato commented Apr 10, 2023

Thanks for the reviews!

@ptomato ptomato merged commit 6d0978d into tc39:main Apr 10, 2023
@ptomato ptomato deleted the temporal-2104 branch April 10, 2023 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants