-
Notifications
You must be signed in to change notification settings - Fork 182
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
Hoist preference enums to shorten imports #5915
Comments
What should the namespace be called?
Discussion:
Conclusion: LGTM: @Manishearth @zbraniecki (@sffc) |
In #5950, @jedel1043 proposed re-exporting the enums from the crates where they are used. I'm not necessarily opposed to this, but it does have various other implications, and we should verify as a TC whether we want to do this or not. |
I think it's just more convenient for users to have all structs related to a bag of settings on a well known location. |
I think the idea is that you'll just do |
Hmmm, maybe that's enough then. I'm slightly worried that we are forcing users of the standalone |
Various factors that make me slightly in favor of the re-export:
Caveats:
I am still in favor of moving the enums within |
Is there any risk that you'd end up with the same preference from different minor revisions of icu_locale_core when vendored from icu_collator vs icu_datetime for example? |
No, it won't be possible to have different minor versions of icu_locale_core in tree. |
ok, then I'm mildly supportive of re-exporting to avoid asking devs to add icu_locale_core to Cargo.toml |
Ok, so if we re-export them, do we re-export with the same names as they have in |
Case by case renamings to remove prefixes seems good. We don't need to e.g. rename HourCycle. |
@robertbastian points out that this can eventually clutter the Can we export these in a
And maybe also move |
Yes, that works for me. |
In general I have a slight preference for having preferences live at the toplevel where it's not too cluttery. But I'm okay with being consistent too. |
I'm happy with use icu_locale_core::preferences::unicode::HourCycle; The |
I see the enums like Unicode Locales have a Unicode Extension Keyword It follows that every crate that uses this enum should export it, ideally under the same name. Since
|
Do you also want to dissolve the |
The There is no such thing as a "Unicode BCP-47 U Preference". |
(note: I may support changing |
Proposal for 2.0:
Agreed: @Manishearth, @sffc Disagrees: @robertbastian, who prefers Proposal for 2.0 Stretch:
Agreed: @Manishearth, @sffc, @robertbastian Side issue: @hsivonen to fix icu_collator's use of options vs preferences. |
Currently if you want to use HourCycle you need to do
which is a big much.
I'd be fine with icu::locale::preferences::HourCycle, Or if you want to namespace it with unicode, icu::locale::unicode::HourCycle? I think at least "extensions" and "keywords" are unnecessary components of the module import path for most users. Actually I'd be fine also with icu::locale::enums::HourCycle.
@zbraniecki said:
The text was updated successfully, but these errors were encountered: