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

Enumerated properties should have to/from ICU4C APIs #6067

Open
Manishearth opened this issue Feb 4, 2025 · 1 comment
Open

Enumerated properties should have to/from ICU4C APIs #6067

Manishearth opened this issue Feb 4, 2025 · 1 comment
Labels
C-unicode Component: Props, sets, tries needs-approval One or more stakeholders need to approve proposal

Comments

@Manishearth
Copy link
Member

Our enumerated properties are opaque wrappers around integers, using the same values used by ICU4C.

It's reasonable to abstract away our internal implementation, but the ICU4C values are pretty standard across i18n code, and it's reasonable to wish to access these values.

We should offer to/from u8 (or u16) APIs.

I propose we name them to_icu4c_value() and from_icu4c_value(), linking to ICU4C docs. There is no fallibility, unknown values are accepted.

I am not opposed to just having Into/From and documenting the impl as stably producing ICU4C values.

cc @sffc @echeran @robertbastian

@Manishearth Manishearth added the C-unicode Component: Props, sets, tries label Feb 4, 2025
@Manishearth Manishearth added this to the ICU4X 2.0 Stretch ⟨P2⟩ milestone Feb 4, 2025
@sffc sffc added the needs-approval One or more stakeholders need to approve proposal label Feb 4, 2025
@sffc
Copy link
Member

sffc commented Feb 4, 2025

I'm fine adding these, since as you observed this is already part of our observable behavior via TrieValue. Prefer explicitly-named functions as usual.

Perhaps to_icu4c_int or to_icu4c_discriminant?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-unicode Component: Props, sets, tries needs-approval One or more stakeholders need to approve proposal
Projects
None yet
Development

No branches or pull requests

2 participants