Skip to content

Change ConflictingField error to contain the previously loaded field #6480

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

Merged
merged 2 commits into from
Apr 21, 2025

Conversation

sffc
Copy link
Member

@sffc sffc commented Apr 21, 2025

Part of #6477

@sffc sffc requested a review from zbraniecki as a code owner April 21, 2025 05:30
@sffc sffc requested review from a team and removed request for zbraniecki April 21, 2025 05:30
@sffc sffc force-pushed the improve-conflicting-field-error branch from 26bdb84 to 2efc46a Compare April 21, 2025 05:37
@sffc sffc requested a review from Manishearth as a code owner April 21, 2025 05:37
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.

Not thrilled about yet another confusing public scaffolding trait, but it's sealed so it
s fine.

@@ -43,6 +43,45 @@ pub trait DateTimeNamesMarker: UnstableSealed {
type MetazoneLookup: NamesContainer<tz::MzPeriodV1, ()>;
}

/// A trait for `Variables` that can be converted to [`ErrorField`]
pub trait MaybeAsErrorField: UnstableSealed {
Copy link
Member

Choose a reason for hiding this comment

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

issue: I think this should be Sealed not UnstableSealed: I don't see a reason for users to be able to overwrite this.

Copy link
Member Author

Choose a reason for hiding this comment

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

After #6475, I think there are no more traits in datetime that don't use UnstableSealed. Why is this trait more special than all the other scaffolding traits?

That said, this type is only useful when applied to the handful of types that are used as Variable, which are fixed.

Copy link
Member Author

Choose a reason for hiding this comment

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

This trait also has an invariant that resolves to a debug assert, which could be an argument that it is in a different class

Copy link
Member

Choose a reason for hiding this comment

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

Why is this trait more special than all the other scaffolding traits?

Justification was provided for the other scaffolding traits.

As a reminder:

@robertbastian was of the opinion that GetField was the only one that should be exposed. We didn't discuss that disagreement in depth then, I think.

To me, consistency is an argument when user confusion is on the cards (unlikely, users aren't supposed to be looking at these), or when it's a sign for some underlying issue. The latter is possible, but I'm not really saying we have the right ontology here, just that I don't wish to expand the set for 2.0 without justification.

A valid justification here would state why a custom FooLength class would be made by a user. I can't immediately see that, I don't think it doesn't exist, but I don't wish to spend time thinking about it.

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.

Discussed with Shane.

Our fundamental actual disagreement ended up being that I view UnstableSealed as more restrictive on ICU4X, since to me it is a commitment that we will continue to expose the functionality even though the API may change, whereas Shane views it as "we don't know yet if we want to seal this, and unstablesealed lets us wait for others to talk to us about it".

I am not convinced of that as a principle for ICU4X overall, but I am comfortable having it be applied to datetime traits, as it's more of a matter of how a codeowner sees it.

@sffc sffc merged commit 6a013d3 into unicode-org:main Apr 21, 2025
29 checks passed
@sffc sffc deleted the improve-conflicting-field-error branch April 21, 2025 21:20
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.

2 participants