Skip to content

Conversation

@sffc
Copy link
Member

@sffc sffc commented Jan 31, 2026

First part of #5937
Last part of #6242

This PR was written with the help of Gemini CLI with some manual tweaks, which you can see in the commit history.

@sffc sffc marked this pull request as ready for review January 31, 2026 01:18
icu::properties::script::HarfbuzzScriptData#Struct
icu::properties::script::HarfbuzzScriptData::new#FnInStruct
icu::properties::script::HarfbuzzScriptDataBorrowed#Struct
icu::time::ZonedTime#Struct
Copy link
Member

Choose a reason for hiding this comment

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

fix?

@sffc sffc added the waiting-on-author PRs waiting for action from the author for >7 days label Feb 2, 2026
@sffc
Copy link
Member Author

sffc commented Feb 2, 2026

My main motivation for this PR was testing gemini-cli. I don't intend to spend more time polishing this API by adding string parsing and FFI. If that is a problem, I can mark it as unstable.

@sffc sffc removed the waiting-on-author PRs waiting for action from the author for >7 days label Feb 2, 2026
@sffc sffc requested a review from robertbastian February 2, 2026 09:07
Copy link
Member

@robertbastian robertbastian left a comment

Choose a reason for hiding this comment

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

My main motivation for this PR was testing gemini-cli. I don't intend to spend more time polishing this API

I spent time on reviewing this PR, so I expect you to spend time addressing my comments.

@sffc sffc requested a review from robertbastian February 2, 2026 09:28
@sffc
Copy link
Member Author

sffc commented Feb 2, 2026

I can mark it as unstable.

^ I was asking for a reply to this.

Copy link
Member

@robertbastian robertbastian left a comment

Choose a reason for hiding this comment

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

I can mark it as unstable.

^ I was asking for a reply to this.

I don't want to add half-baked APIs just because you want to play around with Gemini. Either we do this correctly or we don't.

@robertbastian
Copy link
Member

if not, I think it's more readable to parse a ZonedDateTime and then throw away the date, than to assemble this from parts. this aligns more with what clients will actually do, they have a ZDT but only want to display a ZT

@sffc
Copy link
Member Author

sffc commented Feb 2, 2026

A half-baked API is better landed on main than sitting in a PR.

@sffc sffc requested a review from robertbastian February 2, 2026 09:35
@sffc
Copy link
Member Author

sffc commented Feb 2, 2026

I intend to push some code changes later when I'm back on the correct computer, but I'm still awaiting further discussion on whether ZonedTime without string and FFI is motivated to land, perhaps with an unstable feature.

If we land it, we can keep the issue open for string and FFI.

@sffc
Copy link
Member Author

sffc commented Feb 2, 2026

if not, I think it's more readable to parse a ZonedDateTime and then throw away the date, than to assemble this from parts. this aligns more with what clients will actually do, they have a ZDT but only want to display a ZT

It appears that RFC 9557 only defines suffixes as annotating a date-time, not a standalone date or time

https://www.rfc-editor.org/rfc/rfc9557.html#name-abnf

But, I think we allow annotations on dates?

@robertbastian
Copy link
Member

We allow annotations on dates.

ISO-8601 allows times to be combined with offsets as well: https://en.wikipedia.org/wiki/ISO_8601#Time_zone_designators

So we should parse the strings 12:34:56+01:00, 12:34:56Z, and probably 12:34:56+01:00[Europe/Zurich] into ZonedTime.

@robertbastian
Copy link
Member

A half-baked API is better landed on main than sitting in a PR.

It's better to merge code than to keep PRs open. However I disagree with your statement when it comes to public APIs. I don't want to get into a situation where a non-trivial part of our API surface is unstable just because we wanted to get PRs merged.

@sffc
Copy link
Member Author

sffc commented Feb 3, 2026

It's better to have unstable APIs because subsequent PRs to get them closer to graduation are smaller and bite-size.

@sffc sffc requested a review from a team as a code owner February 3, 2026 03:12
Copy link
Member

@robertbastian robertbastian left a comment

Choose a reason for hiding this comment

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

It's better to have unstable APIs because subsequent PRs to get them closer to graduation are smaller and bite-size.

This PR does the trivial work of adding the ZonedTime type and its 7 GetField implementations. The real work for adding this type has always been adding a ZonedTimeFormatter on FFI, and IXDTF parsing.

The issue is not in the milestone, so nobody is going to do the actual work for this release. As I said before, I don't want to have a half-baked (more like tenth-baked) API, even unstably. So far our unstable APIs have been things that we consider done, but we want to fine-tune for one release. This is not close to done.

This also does not fix the issue like you say in the PR description.

After rereading through the issue, I also still have concerns with this type overall.

Comment on lines +143 to +144
/// "2024-10-18T15:44:00-07:00[America/Los_Angeles]",
/// Iso,
Copy link
Member

Choose a reason for hiding this comment

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

unnecessary change

#[derive(Debug, PartialEq, Eq, Copy, Clone)]
#[allow(clippy::exhaustive_structs)] // this type is stable
#[cfg(feature = "unstable")]
pub struct ZonedTime<Z> {
Copy link
Member

Choose a reason for hiding this comment

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

issue: this needs to be reexported in datetime::input

Copy link
Member

Choose a reason for hiding this comment

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

It's fine to not while this is unstable IMO.

Copy link
Member

@Manishearth Manishearth left a comment

Choose a reason for hiding this comment

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

I think this is sufficiently motivated (see the discussion on the issue). I'm weakly negative on adding unmotivated experimental stuff (I think that is a recipe for "too much unstable"), but this has use cases, and we've had this issue open and in various milestones for a while. So no problem with landing it as unstable from my side. API looks mostly like what I expect.

@sffc
Copy link
Member Author

sffc commented Feb 4, 2026

This PR does the trivial work of adding the ZonedTime type and its 7 GetField implementations. The real work for adding this type has always been adding a ZonedTimeFormatter on FFI, and IXDTF parsing.

If users want this type today, they can write these 7 impls manually in userland, but I think the impls should live in the icu4x components.

The issue is not in the milestone

The WG previously said: "OK to add this type. Cool if it makes 2.0, OK if it doesn't." It didn't make it in 2.0, so then the issue got punted to Priority Backlog. This PR is the first step to solve the issue.

so nobody is going to do the actual work for this release.

We should keep the issue open.

As I said before, I don't want to have a half-baked (more like tenth-baked) API, even unstably. So far our unstable APIs have been things that we consider done, but we want to fine-tune for one release. This is not close to done.

I disagree strongly on a multiple dimensions here:

  1. The current code is good. There are additional APIs that need to be added, sure, but the current code is code that will need to land either way, and it is code that needs to land first.
  2. This API is basically done for Rust users. Additional convenience APIs may be added, but the examples demonstrate that this solves real problems for Rust users.
  3. As a WG we are exceedingly nitpicky about things. I'm not saying this is bad, but the unstable feature is the escape hatch to let us make technical progress despite nitpicks.

This also does not fix the issue like you say in the PR description.

I will fix the PR description.

After rereading through the issue, I also still have concerns with this type overall.

Please comment on the issue with any new information that should make us revisit the WG conclusion.

@sffc sffc added the discuss-priority Discuss at the next ICU4X meeting label Feb 4, 2026
@Manishearth
Copy link
Member

If users want this type today, they can write these 7 impls manually in userland, but I think the impls should live in the icu4x components.

Adding to this, our GetField traits are there for people to use them if they really need, BUT they're unstable and probably should remain as unstable power user APIs, so we should create stable happy paths for use cases we find.

@robertbastian
Copy link
Member

Please comment on the issue with any new information that should make us revisit the WG conclusion.

I have already done this in the issue since the WG decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

discuss-priority Discuss at the next ICU4X meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants