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

Move fallback algorithms and data structs into components #3504

Closed
robertbastian opened this issue Jun 7, 2023 · 2 comments · Fixed by #3527
Closed

Move fallback algorithms and data structs into components #3504

robertbastian opened this issue Jun 7, 2023 · 2 comments · Fixed by #3527
Assignees
Labels
C-data-infra Component: provider, datagen, fallback, adapters S-small Size: One afternoon (small bug fix or enhancement) T-core Type: Required functionality

Comments

@robertbastian
Copy link
Member

The fallback logic encapsulated in the LocaleFallbacker et al1 currently lives in icu_provider_adapters. I propose to move it into components (i.e. icu_fallback/icu::fallback) for these reasons:

  • It requires data. It is the only code in provider/ that defines data keys
  • The functionality of iterating through a fallback chain is independent of providers
  • Baked providers only need LocaleFallbacker to perform fallback (using the provider adapter is probably less efficient), and we don't want it to depend on icu_provider_adapters

The icu_provider_adapters crate will depend on icu_fallback to reexport the API for semver, and to drive the fallback adapter. This works because component crates don't depend on icu_provider_adapters.

Footnotes

  1. icu_provider_adapters::fallback::{provider::*, LocaleFallbacker, LocaleFallbackConfig, LocaleFallbackerWithConfig, LocaleFallbackIterator}. The only thing that's staying is icu_provider_adapters::fallback::LocaleFallbackProvider, the actual provider adapter.

@robertbastian robertbastian added C-data-infra Component: provider, datagen, fallback, adapters discuss-priority Discuss at the next ICU4X meeting labels Jun 7, 2023
@robertbastian
Copy link
Member Author

Putting it in icu_locid_transform might give us some synergies.

@sffc
Copy link
Member

sffc commented Jun 8, 2023

  • @sffc - I'm in agreement about making the fallbacker live in icu_locid_transform in the short term. In the longer term, given that this crate is going to be a core dependency of globaldata, I want to keep it as lightweight as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-data-infra Component: provider, datagen, fallback, adapters S-small Size: One afternoon (small bug fix or enhancement) T-core Type: Required functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants