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

Rename _legacy to _adjust_to_cased #3826

Closed
wants to merge 4 commits into from

Conversation

Manishearth
Copy link
Member

Uses @markusicu's suggestion from #3801 (fixes #3801).

Seems fine, though adjust_to_cased_to_string() is kinda clunky.

This is also the final open stabilization issue, so I'm going to mark this as fixing #3234 . (note for reviewers: if you think there are still outstanding items, feel free to edit the magic issue-closing comment out of this PR body)

@Manishearth Manishearth requested a review from a team as a code owner August 9, 2023 21:18
@Manishearth Manishearth requested a review from sffc August 9, 2023 21:18
@@ -146,16 +146,16 @@ impl CaseMapper {
/// as a `LanguageIdentifier` (usually the `id` field of the `Locale`) if available, or
/// `Default::default()` for the root locale.
///
/// This function performs legacy head adjustment behavior when [`HeadAdjustment::Adjust`] is set. See
/// This function performs "adjust to cased" head adjustment behavior when [`HeadAdjustment::Adjust`] is set. See
Copy link
Member

Choose a reason for hiding this comment

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

"head adjustment" is confusing. I have never heard "head" used in discussion of titlecasing.
How about "titlecasing index adjustment" or similar?

Copy link
Member Author

Choose a reason for hiding this comment

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

We've been calling this HeadAdjustment and TailCasing which I think has a nice symmetry. "Index adjustment" feels more internal, I think "head" is quite clear personally.

Copy link
Member

Choose a reason for hiding this comment

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

Bikeshed:

  • Head/Tail
  • Lead/Trail
  • Start/Remainder

/// See struct docs on [`TitlecaseMapper`] for more information on head adjustment behavior and usage examples.
///
/// ✨ *Enabled with the `compiled_data` Cargo feature.*
///
/// [📚 Help choosing a constructor](icu_provider::constructors)
#[cfg(feature = "compiled_data")]
pub const fn new_legacy() -> Self {
pub const fn new_adjust_to_cased() -> Self {
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: on second thought, we don't really need this constructor. People can use CaseMapper::titlecase_segment_adjust_to_cased if they don't want to load the extra data.

Copy link
Member Author

Choose a reason for hiding this comment

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

What if they want to still have it be the same type, though? Might make it clunky

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 kind-of confusing that HeadAdjustment has 2 choices but there are 3 behaviors. We can add all 3 behaviors to that enum. Over in CaseMapper::titlecase_segment_adjust_to_cased, we decide what to do if given the enum variant which we don't support.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah but the choice of behaviors affects data; we had kinda discussed this model and the 2x2 chart with the merged cells

Copy link
Member

Choose a reason for hiding this comment

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

People who care about their data have a path; people who don't care as much about their data have a cleaner API. I think that's slightly better than a confusing API that affects everyone.

Copy link
Member Author

Choose a reason for hiding this comment

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

Are you proposing we remove specifically the compiled_data adjust_to_cased ctor? That seems okay.

Copy link
Member Author

Choose a reason for hiding this comment

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

What should we do over FFI, then?

@Manishearth
Copy link
Member Author

Superseded by #3843

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.

Decide on naming of "legacy" titlecase adjustment mode
3 participants