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

Prefer String over Cow<'static, str> in CLDR JSON structs #558

Closed
gregtatum opened this issue Mar 18, 2021 · 1 comment · Fixed by #610
Closed

Prefer String over Cow<'static, str> in CLDR JSON structs #558

gregtatum opened this issue Mar 18, 2021 · 1 comment · Fixed by #610
Assignees
Labels
C-data-infra Component: provider, datagen, fallback, adapters S-small Size: One afternoon (small bug fix or enhancement) T-docs-tests Type: Code change outside core library T-techdebt Type: ICU4X code health and tech debt
Milestone

Comments

@gregtatum
Copy link
Member

In the review for #480 @sffc stated:

Since the CLDR JSON is only ever created from serde::from_reader, these strings will never be static. Therefore, I think we should start using plain String in CLDR JSON structs (only in CLDR JSON, not in ICU4X JSON!)

I agree with this analysis, but would prefer it to be a follow-up to handle the entire file to use this practice, and document the reasoning for it.

@gregtatum gregtatum added the T-techdebt Type: ICU4X code health and tech debt label Mar 18, 2021
@sffc sffc added the discuss Discuss at a future ICU4X-SC meeting label Mar 18, 2021
@sffc
Copy link
Member

sffc commented Mar 18, 2021

My recommendation: CLDR JSON structs should be optimized for simplicity and code readability. Performance decisions should be focused on the ICU4X DataProvider structs. This means that in CLDR JSON structs, we can do these things that we can't do in ICU4X structs:

  • HashMap or BTreeMap
  • String
  • More third-party libraries/plugins like itertools

Decision 2021-03-18: Go with this recommendation.

@sffc sffc added the T-docs-tests Type: Code change outside core library label Mar 18, 2021
@sffc sffc added this to the 2021-Q2-m1 milestone Mar 18, 2021
@sffc sffc self-assigned this Mar 18, 2021
@sffc sffc added C-data-infra Component: provider, datagen, fallback, adapters and removed discuss Discuss at a future ICU4X-SC meeting labels Mar 18, 2021
@sffc sffc added the S-small Size: One afternoon (small bug fix or enhancement) label Apr 3, 2021
@sffc sffc modified the milestones: 2021-Q2-m1, ICU4X 0.2 Apr 4, 2021
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-docs-tests Type: Code change outside core library T-techdebt Type: ICU4X code health and tech debt
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants