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

Should Datagen Options be Copy? #3795

Closed
sffc opened this issue Aug 6, 2023 · 1 comment · Fixed by #3861
Closed

Should Datagen Options be Copy? #3795

sffc opened this issue Aug 6, 2023 · 1 comment · Fixed by #3861
Assignees

Comments

@sffc
Copy link
Member

sffc commented Aug 6, 2023

We have a policy of strongly preferring Options structs to be Copy. But the new Datagen Options contain some HashSets. Should they instead be borrowing those fields?

@sffc sffc added the discuss Discuss at a future ICU4X-SC meeting label Aug 6, 2023
@sffc sffc added this to the 1.3 Blocking ⟨P1⟩ milestone Aug 6, 2023
@sffc
Copy link
Member Author

sffc commented Aug 10, 2023

https://unicode-org.github.io/icu4x/docs/icu_datagen/options/struct.Options.html

  • @Manishearth - Datagen is its own thing. When we decided the policy of Copy I was mostly thinking about components. That's not to say that we shouldn't make this Copy, but I feel it's out of scope of the general policy.
  • @robertbastian - Datagen is special and not panic-free.
  • @sffc - Datagen has good reasons for all the places it differs from the components style guide. It's not clear why this case rises to that level.
  • @sffc - Borrowing allows the reuse of options, which seems useful
  • @sffc default-spread for non-exhaustive will probably require Copy
  • @robertbastian - borrowed ergonomics are worse
  • @Manishearth - The component styles were designed for reasons specifically about components. But we can look at these two reasons. For re-use of the options, it's not clear if that's compelling for Datagen. For default-spread, that seems valid. It's not super conventional for options structs to get lifetimes. I'm not opposed to making it Copy, but I'm not convinced we must.
  • @robertbastian - This might not need to be an options bag. Where does the export method live? It could become a free function. It could also be a method on the options bag.
  • @sffc - I do think we should move in the direction of a DataExporter that owns these options and then plumbs a DataProvider to a DataConsumer. And that decision changes whether or not we borrow the options.

Decision: Table this discussion until #3564 is resolved.

@sffc sffc removed the discuss Discuss at a future ICU4X-SC meeting label Aug 10, 2023
@robertbastian robertbastian self-assigned this Aug 14, 2023
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 a pull request may close this issue.

2 participants